consider unavailable responses from the server
Massimo Melina committed
Feb 7, 2022 at 12:44 UTC
83bc707619af6e1caead8817ee62a5a46c7051fc
1 file changed
+4
-4
tests/test.ts
+4
-4
@@ -13,21 +13,21 @@ const password = 'password'
13
14
describe('basics', () => {
15
//before(async () => appStarted)
16
- it('frontend', req('/', s => s.includes('<body>')))
16
+ it('frontend', req('/', s => s?.includes('<body>')))
17
it('api.list', req('/~/api/file_list', data => inList(data, 'f2/') && inList(data, 'page'), {
18
data: { path:'/f1/' }
19
}))
20
it('api.search', req('/~/api/file_list', data => inList(data, 'f2/') && !inList(data, 'page'), {
21
data: { path:'f1', search:'2' }
22
}))
23
- it('download', req('/f1/f2/alfa.txt', s => s.includes('abcd')))
24
- it('partial download', req('/f1/f2/alfa.txt', s => s.includes('a') && !s.includes('d'), {
23
+ it('download', req('/f1/f2/alfa.txt', s => s?.includes('abcd')))
24
+ it('partial download', req('/f1/f2/alfa.txt', s => s?.includes('a') && !s?.includes('d'), {
25
headers: { Range: 'bytes=0-2' }
26
}))
27
it('bad range', req('/f1/f2/alfa.txt', 416, {
28
headers: { Range: 'bytes=7-' }
29
}))
30
- it('website', req('/f1/page/', s => s.includes('This is a test')))
30
+ it('website', req('/f1/page/', s => s?.includes('This is a test')))
31
it('missing perm', req('/for-admins/', 404))
32
it('zip+head', req('/f1/?get=zip',
33
(data, res) => !data && res.headers['content-length'] === '13074',