Files
30-seconds-of-code/test/isDuplexStream.test.js
Christian C. Salvadó 83a6a6ea32 [ENHANCEMENT] Properly configure eslint to work with jest (#988)
* 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
2019-06-18 08:34:45 +03:00

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();
});