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.

939 B
Raw Blame
import { createSignal } from 'solid-js';
import { vi } from 'vitest';
import type { SharingSource } from '../context/contracts';
import type { RequestState } from '../core/types';

export function fakeSharingSource(initial: Partial<RequestState> = {}) {
  const [state, setState] = createSignal<RequestState>({
    owner: 'macro|[email protected]',
    canReview: false,
    accessLevel: 'view',
    supportedLevels: ['view', 'comment', 'edit'],
    requests: [],
    pendingCount: 0,
    ...initial,
  });
  const source: SharingSource = {
    state,
    grants: () => [],
    loading: () => false,
    notFound: () => false,
    busy: () => false,
    error: () => undefined,
    refresh: vi.fn(async () => {}),
    submit: vi.fn(async () => {}),
    cancel: vi.fn(async () => {}),
    resolve: vi.fn(async () => {}),
    setGrant: vi.fn(async () => {}),
    nextPage: vi.fn(),
    firstPage: vi.fn(),
  };
  return { source, setState };
}