* chore: make aware eslint that we use jest By setting up the jest environment, we no longer need to declare the 'test' global in the configuration. * chore: don't need to import expect, it's a jest environment global * chore: don't need to import expect when creating undefined test
19 lines
671 B
JavaScript
19 lines
671 B
JavaScript
const {isDuplexStream} = require('./_30s.js');
|
|
const Stream = require('stream');
|
|
|
|
test('isDuplexStream is a Function', () => {
|
|
expect(isDuplexStream).toBeInstanceOf(Function);
|
|
});
|
|
test('isDuplexStream returns false for read streams', () => {
|
|
expect(isDuplexStream(new Stream.Readable())).toBeFalsy();
|
|
});
|
|
test('isDuplexStream returns false for write streams', () => {
|
|
expect(isDuplexStream(new Stream.Writable())).toBeFalsy();
|
|
});
|
|
test('isDuplexStream returns true for duplex streams', () => {
|
|
expect(isDuplexStream(new Stream.Duplex())).toBeTruthy();
|
|
});
|
|
test('isDuplexStream returns false for non-streams', () => {
|
|
expect(isDuplexStream({})).toBeFalsy();
|
|
});
|