MCPcopy Create free account
hub / github.com/CoderLine/alphaTab / corruptTest

Function corruptTest

packages/alphatab/test/zip/ZipReaderWriter.test.ts:63–84  ·  view source on GitHub ↗
(
            maxBuffer: number,
            mainpulate: (buffer: Uint8Array) => void,
            expectedOverflowLabel: string
        )

Source from the content-addressed store, hash-verified

61
62 describe('corrupt', () => {
63 async function corruptTest(
64 maxBuffer: number,
65 mainpulate: (buffer: Uint8Array) => void,
66 expectedOverflowLabel: string
67 ) {
68 const buffer = await TestPlatform.loadFile(`test-data/corrupt/healthy.gp`);
69
70 mainpulate(buffer);
71
72 const importer = new ZipReader(ByteBuffer.fromBuffer(buffer), maxBuffer);
73
74 try {
75 importer.read();
76 throw new Error('Expected zip read to fail with an OverflowError');
77 } catch (e) {
78 if (e instanceof OverflowError) {
79 expect((e as OverflowError).message).toContain(expectedOverflowLabel);
80 return;
81 }
82 throw e;
83 }
84 }
85
86 // properly announce compressed size which exceeds the range (100kb max, 300kb announced)
87 it('uncompressed-size', async () =>

Callers 1

Calls 4

readMethod · 0.95
fromBufferMethod · 0.80
loadFileMethod · 0.45
toContainMethod · 0.45

Tested by

no test coverage detected