Add is.nodeStream() (#34)
This commit is contained in:
parent
ae3adc9818
commit
a04a04c131
4 changed files with 38 additions and 1 deletions
|
|
@ -1,4 +1,8 @@
|
|||
import * as fs from 'fs';
|
||||
import * as net from 'net';
|
||||
import * as Stream from 'stream';
|
||||
import * as util from 'util';
|
||||
import * as tempy from 'tempy';
|
||||
import test, {TestContext, Context} from 'ava';
|
||||
import {jsdom} from 'jsdom';
|
||||
import m from '..';
|
||||
|
|
@ -286,7 +290,8 @@ const types = new Map<string, Test>([
|
|||
'canvas',
|
||||
'script'
|
||||
].map(createDomElement) }
|
||||
], ['non-domElements', {
|
||||
],
|
||||
['non-domElements', {
|
||||
is: value => !m.domElement(value),
|
||||
fixtures: [
|
||||
document.createTextNode('data'),
|
||||
|
|
@ -297,6 +302,20 @@ const types = new Map<string, Test>([
|
|||
document.createDocumentFragment()
|
||||
]
|
||||
}],
|
||||
['nodeStream', {
|
||||
is: m.nodeStream,
|
||||
fixtures: [
|
||||
fs.createReadStream('readme.md'),
|
||||
fs.createWriteStream(tempy.file()),
|
||||
new net.Socket(),
|
||||
new Stream.Duplex(),
|
||||
new Stream.PassThrough(),
|
||||
new Stream.Readable(),
|
||||
new Stream.Transform(),
|
||||
new Stream.Stream(),
|
||||
new Stream.Writable()
|
||||
]
|
||||
}],
|
||||
['infinite', {
|
||||
is: m.infinite,
|
||||
fixtures: [
|
||||
|
|
@ -641,6 +660,10 @@ test('is.domElement', t => {
|
|||
t.false(m.domElement({nodeType: 1, nodeName: 'div'}));
|
||||
});
|
||||
|
||||
test('is.nodeStream', t => {
|
||||
testType(t, 'nodeStream');
|
||||
});
|
||||
|
||||
test('is.infinite', t => {
|
||||
testType(t, 'infinite', ['number']);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue