Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
import { afterEach, beforeEach, expect, it, vi } from 'vitest';
import { SignatureForm } from './signature-form';
beforeEach(() =>
vi.stubGlobal(
'ResizeObserver',
class {
observe() {}
unobserve() {}
disconnect() {}
}
)
);
afterEach(() => {
cleanup();
vi.unstubAllGlobals();
});
const baseProps = {
email: '[email protected]',
value: '',
onInput: () => {},
onReady: () => {},
onSave: () => {},
onClear: () => {},
dirty: false,
hasContent: false,
pending: false,
replies: false,
onRepliesChange: () => {},
};
it('offers Gmail import on desktop and locks the form while importing', () => {
const onImport = vi.fn();
const { unmount } = render(() => (
<SignatureForm {...baseProps} mobile={false} onImport={onImport} />
));
fireEvent.click(screen.getByRole('button', { name: 'Import from Gmail' }));
expect(onImport).toHaveBeenCalledOnce();
unmount();
render(() => (
<SignatureForm
{...baseProps}
mobile={false}
hasContent
dirty
onImport={onImport}
importing
/>
));
for (const name of ['Importing…', 'Clear signature', 'Save signature'])
expect(
(screen.getByRole('button', { name }) as HTMLButtonElement).disabled
).toBe(true);
});
it('hides Gmail import on mobile or without a handler', () => {
const { unmount } = render(() => (
<SignatureForm {...baseProps} mobile onImport={() => {}} />
));
expect(
screen.queryByRole('button', { name: 'Import from Gmail' })
).toBeNull();
unmount();
render(() => <SignatureForm {...baseProps} mobile={false} />);
expect(
screen.queryByRole('button', { name: 'Import from Gmail' })
).toBeNull();
});
it('says a shared inbox signature applies to everyone who sends from it', () => {
render(() => <SignatureForm {...baseProps} mobile={false} shared />);
expect(
screen.getByText(
'Shared inbox. Automatically added to new emails anyone sends from this account.'
)
).toBeTruthy();
});