From 54852df7380f3cf9e30d9196030cbca125cfd97e Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:12:19 +0100 Subject: [PATCH] test: stop a pinned download at the organisation limit when the size is missing --- lib/store/__tests__/files.test.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/store/__tests__/files.test.ts b/lib/store/__tests__/files.test.ts index fe2dd5b39..c615a43d2 100644 --- a/lib/store/__tests__/files.test.ts +++ b/lib/store/__tests__/files.test.ts @@ -523,6 +523,17 @@ describe('pinned files', () => { expect((await engine.areaCall('files.kept', undefined) as any).files[0]).toMatchObject({ kept: false, error: 'overLimit' }); }); + it('stops a pinned download at the organisation limit, whatever the size says', async () => { + const server = new FakeFiles(); + server.partBytes = 10; + const big = server.addFile('big', null, new Uint8Array(1000), { size: null }); + const { engine } = await synced(server, { orgMaxFileBytes: 50 }); + await engine.areaCall('files.pin', ref(big.id)); + await engine.requestSync(); + expect(server.delivered.get(big.blobId as string)).toBeLessThanOrEqual(60); + expect((await engine.areaCall('files.kept', undefined) as any).files[0]).toMatchObject({ kept: false, error: 'tooLarge' }); + }); + it('writes a download in pieces and gives nothing out until it is complete', async () => { const server = new FakeFiles(); const file = server.addFile('big', null, new Uint8Array(3 * 1024 * 1024).fill(7));