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 { afterEach, describe, expect, it } from 'vitest';
import {
createMobileSearchSession,
createMobileSearchState,
} from './mobileSearchState';
const state = createMobileSearchState();
afterEach(() => state.close());
describe('mobile search session', () => {
it('shares composer promotion across the session until the input is cleared', () => {
state.open();
const session = state.session();
state.setQuery('short search');
expect(session.universalInputActive()).toBe(false);
state.setQuery('create a task for the big launch plan');
expect(session.universalInputActive()).toBe(true);
state.setQuery('short');
expect(session.universalInputActive()).toBe(true);
const restored = createMobileSearchSession(session.snapshot());
expect(restored.universalInputActive()).toBe(true);
restored.setQuery('');
expect(restored.universalInputActive()).toBe(false);
state.setQuery('');
expect(session.universalInputActive()).toBe(false);
});
it('keeps full text while editing and switching categories, then resets on whitespace', () => {
state.open();
state.setCategory('email');
state.setQuery('teo');
state.searchFullText();
state.setQuery('teo update');
state.setCategory('tasks');
expect(state.mode()).toBe('full-text');
expect(state.query()).toBe('teo update');
state.setQuery(' \t ');
expect(state.mode()).toBe('name');
expect(state.category()).toBe('tasks');
state.setQuery('t');
expect(state.mode()).toBe('name');
});
it('keeps Projects name-only and retains the query when selected', () => {
state.open();
state.setQuery('teo');
state.searchFullText();
state.setCategory('projects');
expect(state.mode()).toBe('name');
expect(state.query()).toBe('teo');
state.searchFullText();
expect(state.mode()).toBe('name');
});
it('ignores repeated open and starts a new session in All/name after close', () => {
state.open();
state.setCategory('email');
state.setQuery('teo');
state.searchFullText();
state.open();
expect(state.mode()).toBe('full-text');
expect(state.category()).toBe('email');
state.close();
state.open();
expect(state.query()).toBe('');
expect(state.category()).toBe('all');
expect(state.mode()).toBe('name');
state.searchFullText();
expect(state.mode()).toBe('name');
});
});