-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.test.js
36 lines (25 loc) · 926 Bytes
/
index.test.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
const faas = require('./index');
jest.setTimeout(2 * 60 * 1000);
test('random cold start delay', async () => {
let time = await faas.simulateColdStart();
expect(time).toBeGreaterThanOrEqual(0);
expect(time).toBeLessThanOrEqual(2000);
});
test('random cold start delay, max 1000ms', async () => {
let time = await faas.simulateColdStart(1000);
expect(time).toBeGreaterThanOrEqual(0);
expect(time).toBeLessThanOrEqual(1000);
});
test('random cold start delay between 10ms and 20ms', async () => {
let time = await faas.simulateColdStart(10, 20);
expect(time).toBeGreaterThanOrEqual(10);
expect(time).toBeLessThanOrEqual(20);
});
test('cold start delay exactly 234ms', async () => {
let time = await faas.simulateColdStart(234, 20, true);
expect(time).toBe(234);
});
test('force timeout for six seconds', async () => {
let time = await faas.simulateTimeout(0.1);
expect(time).toBe(6000);
});