dev: 2 new tests for zip

Massimo Melina committed Jan 4, 2023 at 16:09 UTC d044f9a6803cc475ce980731976e886a1bf078ed
1 file changed +6 -2
tests/test.ts
+6 -2
@@ -66,8 +66,12 @@ describe('basics', () => {
66 it('protectFromAbove', req('/protectFromAbove/child/alfa.txt', 403))
67 it('protectFromAbove.list', reqList('/protectFromAbove/child/', { outList:['alfa.txt'] }))
68
69 - it('zip.head', req('/f1/?get=zip', { empty:true, length:13010 }, { method:'HEAD' }) )
70 - it('zip.partial', req('/f1/f2/?get=zip', { re:/^6/, length:10 }, { headers: { Range: 'bytes=-10' } }) )
69 + const zipSize = 13010
70 + const zipOfs = 5000
71 + it('zip.head', req('/f1/?get=zip', { empty:true, length:zipSize }, { method:'HEAD' }) )
72 + it('zip.partial', req('/f1/?get=zip', { re:/^C3$/, length: 2 }, { headers: { Range: `bytes=${zipOfs}-${zipOfs+1}` } }) )
73 + it('zip.partial.resume', req('/f1/?get=zip', { re:/^C3/, length:zipSize-zipOfs }, { headers: { Range: `bytes=${zipOfs}-` } }) )
74 + it('zip.partial.end', req('/f1/f2/?get=zip', { re:/^6/, length:10 }, { headers: { Range: 'bytes=-10' } }) )
75 it('zip.alfa is forbidden', req('/protectFromAbove/child/?get=zip&list=alfa.txt*renamed', { empty: true, length:118 }, { method:'HEAD' }))
76 it('login', reqApi('login', { username, password }, 406)) // by default, we don't support clear-text login
77