style(13-03): apply Prettier formatting across repo

Mechanical reformat — no logic changes. 398 files changed, 19125
insertions(+), 16457 deletions(-). Prettier 3.8.4 with .prettierrc
(singleQuote:true, semi:true, tabWidth:2, trailingComma:all,
printWidth:100). Isolated per D-13-08 for reviewability.
This commit is contained in:
Lucas Berger
2026-06-11 20:35:18 -04:00
parent 4bc0445173
commit 982438dc10
398 changed files with 19050 additions and 16382 deletions
+39 -39
View File
@@ -10,67 +10,67 @@
* Run: pnpm --filter @familysync/api exec vitest run tests/lib/pushCoalescer.test.ts
*/
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
describe('pushCoalescer — list-change burst coalescing (D-01)', () => {
beforeEach(() => {
vi.useFakeTimers()
vi.resetModules()
})
vi.useFakeTimers();
vi.resetModules();
});
afterEach(() => {
vi.useRealTimers()
})
vi.useRealTimers();
});
it('collapses N rapid coalesceListPush calls into a single dispatch with count=N', async () => {
const dispatch = vi.fn().mockResolvedValue(undefined)
const { coalesceListPush } = await import('../../src/lib/pushCoalescer.js')
const dispatch = vi.fn().mockResolvedValue(undefined);
const { coalesceListPush } = await import('../../src/lib/pushCoalescer.js');
const listId = 1
const actorId = 10
const N = 5
const listId = 1;
const actorId = 10;
const N = 5;
for (let i = 0; i < N; i++) {
coalesceListPush(listId, actorId, dispatch)
coalesceListPush(listId, actorId, dispatch);
}
// Advance time past the coalesce window
await vi.runAllTimersAsync()
await vi.runAllTimersAsync();
expect(dispatch).toHaveBeenCalledTimes(1)
const [calledListId, calledActorId, calledCount] = dispatch.mock.calls[0]
expect(calledListId).toBe(listId)
expect(calledActorId).toBe(actorId)
expect(calledCount).toBe(N)
})
expect(dispatch).toHaveBeenCalledTimes(1);
const [calledListId, calledActorId, calledCount] = dispatch.mock.calls[0];
expect(calledListId).toBe(listId);
expect(calledActorId).toBe(actorId);
expect(calledCount).toBe(N);
});
it('passes the actor userId as excludeUserId so the actor does not notify themselves (D-03)', async () => {
const dispatch = vi.fn().mockResolvedValue(undefined)
const { coalesceListPush } = await import('../../src/lib/pushCoalescer.js')
const dispatch = vi.fn().mockResolvedValue(undefined);
const { coalesceListPush } = await import('../../src/lib/pushCoalescer.js');
const listId = 2
const actorId = 99
const listId = 2;
const actorId = 99;
coalesceListPush(listId, actorId, dispatch)
await vi.runAllTimersAsync()
coalesceListPush(listId, actorId, dispatch);
await vi.runAllTimersAsync();
expect(dispatch).toHaveBeenCalledTimes(1)
const [, calledActorId] = dispatch.mock.calls[0]
expect(calledActorId).toBe(actorId)
})
expect(dispatch).toHaveBeenCalledTimes(1);
const [, calledActorId] = dispatch.mock.calls[0];
expect(calledActorId).toBe(actorId);
});
it('fires separate dispatches for different lists independently', async () => {
const dispatch = vi.fn().mockResolvedValue(undefined)
const { coalesceListPush } = await import('../../src/lib/pushCoalescer.js')
const dispatch = vi.fn().mockResolvedValue(undefined);
const { coalesceListPush } = await import('../../src/lib/pushCoalescer.js');
coalesceListPush(1, 10, dispatch)
coalesceListPush(1, 10, dispatch)
coalesceListPush(2, 10, dispatch) // different list
coalesceListPush(2, 10, dispatch)
coalesceListPush(1, 10, dispatch);
coalesceListPush(1, 10, dispatch);
coalesceListPush(2, 10, dispatch); // different list
coalesceListPush(2, 10, dispatch);
await vi.runAllTimersAsync()
await vi.runAllTimersAsync();
// Two separate dispatches — one per distinct listId
expect(dispatch).toHaveBeenCalledTimes(2)
})
})
expect(dispatch).toHaveBeenCalledTimes(2);
});
});