Skip to content

Commit 52c52be

Browse files
committed
test(copilot): declare the ratio-test expansion instead of carrying it
The compression-ratio case built a real 400 MiB string and deflated it synchronously, costing the parallel test runner memory and CPU for no added coverage. The guard reads the total the archive declares, so declaring the expansion exercises the same ratio path with a few-hundred-byte fixture. Still fails when the guard call is removed, and the file now runs in 286 ms instead of seconds. Caught by Greptile review.
1 parent a917b14 commit 52c52be

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

apps/sim/lib/copilot/vfs/document-style.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,15 @@ describe('extractDocumentStyle', () => {
144144
})
145145

146146
it('never hands JSZip an archive with an implausible compression ratio', async () => {
147+
// 400 MiB sits under the 1 GiB absolute cap, so this exercises the ratio
148+
// check rather than the size check. Declaring the expansion rather than
149+
// carrying it keeps the fixture a few hundred bytes — the guard reads the
150+
// declared total, so a real payload would only cost the suite memory.
147151
const bomb = buildZip([
148152
{
149153
name: 'word/theme/theme1.xml',
150-
content: 'A'.repeat(400 * 1024 * 1024),
154+
content: THEME_XML,
155+
declaredUncompressedSize: 400 * 1024 * 1024,
151156
},
152157
])
153158

0 commit comments

Comments
 (0)