-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main-tests.js
52 lines (42 loc) · 1.34 KB
/
main-tests.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const supertestPackage = require('supertest');
const mod = require('./main.js');
describe('OLSKStartStaticFiles', function () {
const item = mod.OLSKExpressStart(__dirname, {
OLSKOptionSkipServer: true,
OLSKOptionSkipCleanup: true,
});
it('returns 404 if undeclared', function () {
return supertestPackage(item)
.get('/alfa-bravo/echo.js')
.expect(404);
});
it('returns 404 if undeclared (controller.js)', function () {
return supertestPackage(item)
.get('/alfa-bravo/controller.js')
.expect(404);
});
it('returns 200 if declared', function () {
return supertestPackage(item)
.get('/alfa-bravo/charlie.txt')
.expect('Content-Type', /text/)
.expect(200, 'delta');
});
it('returns 200 if prefixed with ui-', function () {
return supertestPackage(item)
.get('/alfa-bravo/ui-golf.js')
.expect('Content-Type', /javascript/)
.expect(200, 'hotel');
});
it('returns 200 if inside ui-* folder', function () {
return supertestPackage(item)
.get('/alfa-bravo/ui-india/juliet.txt')
.expect('Content-Type', /text/)
.expect(200, 'kilo');
});
it('returns 200 if inside declared folder', function () {
return supertestPackage(item)
.get('/lima/mike.json')
.expect('Content-Type', /json/)
.expect(200, '{"november":1}');
});
});