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
chg(app): random change to test ci (#17)
teoff7055c171f3
diff --git a/js/app/packages/app/component/split-layout/tests/layoutManager.test.ts b/js/app/packages/app/component/split-layout/tests/layoutManager.test.tsindex 99d2c2982d..e8b377f195 100644--- a/js/app/packages/app/component/split-layout/tests/layoutManager.test.ts+++ b/js/app/packages/app/component/split-layout/tests/layoutManager.test.ts@@ -1,6 +1,6 @@import type { BlockOrchestrator } from '@core/orchestrator';import { createRoot } from 'solid-js';-import { describe, expect, it, vi } from 'vitest';+import { beforeAll, describe, expect, it, vi } from 'vitest';import { createSplitLayout } from '../layoutManager';vi.mock('../componentRegistry.tsx', () => ({@@ -11,6 +11,25 @@ vi.mock('../componentRegistry.tsx', () => ({})),}));+vi.mock('zod', () => ({ z: undefined }));++beforeAll(() => {+ // Mock window.matchMedia for tests+ Object.defineProperty(window, 'matchMedia', {+ writable: true,+ value: (query: string) => ({+ matches: false,+ media: query,+ onchange: null,+ addListener: () => {},+ removeListener: () => {},+ addEventListener: () => {},+ removeEventListener: () => {},+ dispatchEvent: () => true,+ }),+ });+});+function createMockOrchestrator(): BlockOrchestrator {return {createBlockInstance: vi.fn((_type, id, _splitId) => ({diff --git a/js/app/packages/core/mobile/isTouchDevice.ts b/js/app/packages/core/mobile/isTouchDevice.tsindex aabe6c0a0d..28f62ec9fe 100644--- a/js/app/packages/core/mobile/isTouchDevice.ts+++ b/js/app/packages/core/mobile/isTouchDevice.ts@@ -1,5 +1,5 @@const isTouchDevice = (() => {- if (typeof window === 'undefined') return false;+ if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return false;// Check if primary input is coarse (finger/stylus) rather than fine (mouse)const hasCoarsePointer = window.matchMedia('(pointer: coarse)').matches;diff --git a/js/app/packages/core/tests/token.test.ts b/js/app/packages/core/tests/token.test.tsindex 8e4a729687..0fab189d02 100644--- a/js/app/packages/core/tests/token.test.ts+++ b/js/app/packages/core/tests/token.test.ts@@ -16,6 +16,7 @@ vi.mock('@service-storage/client', () => ({vi.mock('@solid-primitives/rootless', () => ({createCallback: vi.fn((fn) => fn),+ createSingletonRoot: vi.fn((fn) => fn()),}));import { storageServiceClient } from '@service-storage/client';diff --git a/js/app/packages/core/util/fetchWithToken.spec.ts b/js/app/packages/core/util/fetchWithToken.spec.tsdeleted file mode 100644index 07e7fced8c..0000000000--- a/js/app/packages/core/util/fetchWithToken.spec.ts+++ /dev/null@@ -1,149 +0,0 @@-/**- * @vitest-environment happy-dom- */--import {- afterEach,- beforeAll,- beforeEach,- describe,- expect,- test,- vi,-} from 'vitest';-import { fetchWithToken, unsetTokenPromise } from './fetchWithToken';-import { err, ok } from './maybeResult';--vi.mock('./safeFetch', () => ({- safeFetch: vi.fn(),-}));--describe('fetchWithToken', () => {- let mockSafeFetch: any;-- beforeEach(async () => {- unsetTokenPromise();- // Import the mocked module- const { safeFetch } = await import('./safeFetch');- mockSafeFetch = safeFetch;- // Reset to default implementation- mockSafeFetch.mockResolvedValue(ok({ data: 'mocked data' }));- });-- afterEach(() => {- vi.clearAllMocks();- });-- beforeAll(() => {- // Mock window.matchMedia for tests- Object.defineProperty(window, 'matchMedia', {- writable: true,- value: (query: string) => ({- matches: false,- media: query,- onchange: null,- addListener: () => {},- removeListener: () => {},- addEventListener: () => {},- removeEventListener: () => {},- dispatchEvent: () => true,- }),- });- });-- test('successful request', async () => {- const result = await fetchWithToken<{ data: string }>(- 'https://localhost/api/data'- );-- expect(mockSafeFetch).toHaveBeenCalledTimes(1);- expect(result[0]).toBeNull();- expect(result[1]).toEqual({ data: 'mocked data' });- });-- test('unauthorized error triggers token fetch and retry', async () => {- mockSafeFetch- .mockImplementationOnce(() =>- Promise.resolve(err('UNAUTHORIZED', 'Unauthorized access'))- )- .mockImplementationOnce(() => Promise.resolve(ok({ token: 'new_token' })))- .mockImplementationOnce(() =>- Promise.resolve(ok({ data: 'data after token refresh' }))- );-- const result = await fetchWithToken<{ data: string }>(- 'https://localhost/api/data'- );-- expect(mockSafeFetch).toHaveBeenCalledTimes(3);- expect(result[0]).toBeNull();- expect(result[1]).toEqual({ data: 'data after token refresh' });- });-- test('token fetch failure', async () => {- mockSafeFetch- .mockImplementationOnce(() =>- Promise.resolve(err('UNAUTHORIZED', 'Unauthorized access'))- )- .mockImplementationOnce(() =>- Promise.resolve(err('GRAPHQL_ERROR', 'Failed to fetch token'))- );-- const result = await fetchWithToken<{ data: string }>(- 'https://localhost/api/data'- );-- expect(mockSafeFetch).toHaveBeenCalledTimes(2);- expect(result[0]).toEqual([- { code: 'GRAPHQL_ERROR', message: 'Failed to fetch token' },- ]);- expect(result[1]).toBeNull();- });-- test('non-unauthorized error', async () => {- mockSafeFetch.mockImplementationOnce(() =>- Promise.resolve(err('NETWORK_ERROR', 'Network error occurred'))- );-- const result = await fetchWithToken<{ data: string }>(- 'https://localhost/api/data'- );-- expect(mockSafeFetch).toHaveBeenCalledTimes(1);- expect(result[0]).toEqual([- { code: 'NETWORK_ERROR', message: 'Network error occurred' },- ]);- expect(result[1]).toBeNull();- });-- test('unsetTokenPromise forces new token fetch on next request', async () => {- mockSafeFetch- .mockImplementationOnce(() => Promise.resolve(ok({ data: 'first data' })))- .mockImplementationOnce(() =>- Promise.resolve(ok({ data: 'second data' }))- );-- await fetchWithToken<{ data: string }>('https://localhost/api/data');- unsetTokenPromise();- const result = await fetchWithToken<{ data: string }>(- 'https://localhost/api/data'- );-- expect(mockSafeFetch).toHaveBeenCalledTimes(2);- expect(result[0]).toBeNull();- expect(result[1]).toEqual({ data: 'second data' });- });-- test('retry configuration is passed to safeFetch', async () => {- await fetchWithToken<{ data: string }>('https://localhost/api/data', {- retry: { maxTries: 3, delay: 'exponential' },- });-- expect(mockSafeFetch).toHaveBeenCalledWith(- 'https://localhost/api/data',- expect.objectContaining({- retry: { maxTries: 3, delay: 'exponential' },- })- );- });-});diff --git a/js/app/packages/notifications/notificationSource.ts b/js/app/packages/notifications/notificationSource.tsindex 8bd49e9e50..d413dd164f 100644--- a/js/app/packages/notifications/notificationSource.ts+++ b/js/app/packages/notifications/notificationSource.ts@@ -90,6 +90,9 @@ export function createNotificationSource(Object.values(trackStore(store)).flat());+ // TODO: remove+ console.log('creating notification source');+const [mutedEntities, setMutedEntities] = createSignal<UserUnsubscribe[]>([]);const notificationsQuery = createNotificationQuery({ limit: QUERY_LIMIT });