(
maxBuffer: number,
mainpulate: (buffer: Uint8Array) => void,
expectedOverflowLabel: string
)
| 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 () => |
no test coverage detected