Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

825 B
Raw Blame
import { expect, it } from 'vitest';
import { failedReadAccess } from '../failed-read';

const failure = (code: string, refusal?: { code: string }) => ({
  name: 'ResultError',
  code,
  message: code,
  refusal,
});

it('reads an item the service reports missing as deleted', () => {
  expect(failedReadAccess([failure('NOT_FOUND')])).toBe('does_not_exist');
  expect(failedReadAccess([failure('GONE')])).toBe('does_not_exist');
  expect(failedReadAccess([failure('FORBIDDEN', { code: 'notFound' })])).toBe(
    'does_not_exist'
  );
});

it('reads any other failure as hidden from the viewer', () => {
  expect(failedReadAccess([failure('FORBIDDEN')])).toBe('no_access');
  expect(failedReadAccess([failure('UNAUTHORIZED')])).toBe('no_access');
  expect(failedReadAccess([failure('NETWORK_ERROR')])).toBe('no_access');
});