Total Complexity | 2 |
Complexity/F | 1 |
Lines of Code | 26 |
Function Count | 2 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { assert } from 'chai'; |
||
2 | import { |
||
3 | getBenchmark, |
||
4 | startBenchmark |
||
5 | } from '../../entry'; |
||
6 | import { sleep } from '../../utils'; |
||
7 | |||
8 | suite('Benchmarks #nodejs'); |
||
9 | |||
10 | test('Positive: min measurable time', function () { |
||
11 | const time = startBenchmark(); |
||
12 | const benchmark = getBenchmark(time); |
||
13 | |||
14 | assert.isString(benchmark); |
||
15 | assert.isNumber(+benchmark); |
||
16 | }); |
||
17 | |||
18 | test('Positive: measure time', async function () { |
||
19 | const time = startBenchmark(); |
||
20 | |||
21 | await sleep(20); |
||
22 | const benchmark = getBenchmark(time); |
||
23 | |||
24 | assert.isString(benchmark); |
||
25 | assert.isAtLeast(+benchmark, 19); |
||
26 | }); |
||
27 |