diff --git a/client/scripts/eslint-baseline.json b/client/scripts/eslint-baseline.json index f47ce22ec..e4d70fd48 100644 --- a/client/scripts/eslint-baseline.json +++ b/client/scripts/eslint-baseline.json @@ -1,6 +1,6 @@ { "src": { - "@typescript-eslint/no-non-null-assertion": 367, + "@typescript-eslint/no-non-null-assertion": 354, "@typescript-eslint/no-misused-promises": 820, "no-console": 88, "complexity": 216, diff --git a/server/tests/unit/nest/memories/public-media.service.test.ts b/server/tests/unit/nest/memories/public-media.service.test.ts index e552b48f1..94ae8f5a9 100644 --- a/server/tests/unit/nest/memories/public-media.service.test.ts +++ b/server/tests/unit/nest/memories/public-media.service.test.ts @@ -118,14 +118,20 @@ describe('renditionFor', () => { it('PMEDIA-006: a copy that takes longer than a request waits is refused as pending and finished for the next one', async () => { write('journey', 'long.jpg', phonePhoto()); let release = () => {}; + let started = () => {}; const held = new Promise((resolve) => (release = resolve)); + const building = new Promise((resolve) => (started = resolve)); storage.withLocalFile.mockImplementationOnce(async (category, name, fn) => { + started(); await held; return fn(at(category, name)); }); vi.useFakeTimers({ toFake: ['setTimeout', 'clearTimeout'] }); try { const first = expect(service.renditionFor('journey', 'long.jpg')).rejects.toBeInstanceOf(RenditionPendingError); + // Only once the copy has started is its wait armed; advancing before that + // skipped past a timer that did not exist yet, and the test hung on a slow runner. + await building; await vi.advanceTimersByTimeAsync(50_000); await first; } finally {