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.

1.3 KB
Raw Blame
import { describe, expect, it } from 'vitest';
import { availabilitySources } from './availability';

const calendar = (calendarId: string, name = calendarId) => ({
  calendarId,
  name,
  isPrimary: false,
  contributesToAvailability: false,
});

describe('availabilitySources', () => {
  it('keeps source order, colors, and accounts for countable calendars', () => {
    const primary = {
      id: 'primary',
      name: '[email protected]',
      color: 'red',
      emailAddress: '[email protected]',
      emailLinkId: 'link',
      isPrimary: true,
    };
    const holidays = {
      id: 'holidays',
      name: 'Holidays',
      color: 'green',
      emailAddress: '[email protected]',
      emailLinkId: 'link',
      isSubscription: true,
    };
    const hidden = { id: 'not-countable', name: 'Other', color: 'blue' };
    expect(
      availabilitySources(
        [primary, hidden, holidays],
        [calendar('holidays'), calendar('primary')]
      )
    ).toEqual([primary, holidays]);
  });

  it('still lists a countable calendar the source list has not loaded', () => {
    expect(availabilitySources([], [calendar('new', 'New calendar')])).toEqual([
      {
        id: 'new',
        name: 'New calendar',
        color: 'var(--color-accent)',
        isPrimary: false,
      },
    ]);
  });
});