* 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
695 B
JavaScript
19 lines
695 B
JavaScript
const { isWritableStream } = require('./_30s.js');
|
|
const Stream = require('stream');
|
|
|
|
test('isWritableStream is a Function', () => {
|
|
expect(isWritableStream).toBeInstanceOf(Function);
|
|
});
|
|
test('isWritableStream returns false for read streams', () => {
|
|
expect(isWritableStream(new Stream.Readable())).toBeFalsy();
|
|
});
|
|
test('isWritableStream returns true for write streams', () => {
|
|
expect(isWritableStream(new Stream.Writable())).toBeTruthy();
|
|
});
|
|
test('isWritableStream returns true for duplex streams', () => {
|
|
expect(isWritableStream(new Stream.Duplex())).toBeTruthy();
|
|
});
|
|
test('isWritableStream returns false for non-streams', () => {
|
|
expect(isWritableStream({})).toBeFalsy();
|
|
});
|