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

tests/helpers/checkType/isStream.test.js   A

Complexity

Total Complexity 4
Complexity/F 1

Size

Lines of Code 26
Function Count 4

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 18
mnd 0
bc 0
fnc 4
dl 0
loc 26
rs 10
bpm 0
cpm 1
noi 0
c 0
b 0
f 0
1
import fs from 'fs';
2
import path from 'path';
3
import { isStream } from 'tests/entry';
4
import { FunctionTester, testsRootFolder } from '../../Test';
5
6
const directory = path.join(testsRootFolder, 'mock/files/');
7
const tester = new FunctionTester(isStream);
8
9
suite('CheckTypes: isStream');
10
11
test('Positive: isStream with node fs streams input @example', function () {
12
    tester.test(fs.createReadStream(path.join(directory, 'input.txt')), true);
13
    tester.test(fs.createWriteStream(path.join(directory, 'out.txt')), true);
14
});
15
16
test('Negative: isStream with no-streams input @example', function () {
17
    tester.test(14, false);
18
    tester.test('sdsdsd', false);
19
    tester.test(() => {}, false);
20
    tester.test(class A {}, false);
21
    tester.test(undefined, false);
22
});
23
24
after(async function () {
25
    // console.log('after', this);
26
});
27
28