Passed
Push — master ( 86ced5...e9c0b0 )
by Dmytro
01:49
created

tests/helpers/benchmark/benchmarks.test.js   A

Complexity

Total Complexity 2
Complexity/F 1

Size

Lines of Code 26
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 17
mnd 0
bc 0
fnc 2
dl 0
loc 26
rs 10
bpm 0
cpm 1
noi 0
c 0
b 0
f 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