Skip to content
This repository was archived by the owner on Jun 24, 2024. It is now read-only.

Commit 4648b16

Browse files
Walkerdigitalsadhu
authored andcommitted
tests(reader): Add snapshots to thrown errors
1 parent 7ac0208 commit 4648b16

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`new Reader(): throws on no input 1`] = `
4+
"Expected first argument to new Reader() to be a stream or array of streams.
5+
Instead got undefined"
6+
`;
7+
8+
exports[`new Reader([]): throws on empty array 1`] = `"Expected at least one stream to be provided to new Reader(). Got none."`;
9+
10+
exports[`new Reader([1,2,3]): throws on array containing non stream items 1`] = `"readStream.on is not a function"`;
11+
12+
exports[`new Reader(123): throws on non stream or array input 1`] = `"readStream.on is not a function"`;

test/reader.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,25 +155,25 @@ test('Event: parse error', done => {
155155
test('new Reader(): throws on no input', () => {
156156
expect.assertions(1);
157157
const result = () => new Reader();
158-
expect(result).toThrow();
158+
expect(result).toThrowErrorMatchingSnapshot();
159159
});
160160

161161
test('new Reader(123): throws on non stream or array input', () => {
162162
expect.assertions(1);
163163
const result = () => new Reader(123);
164-
expect(result).toThrow();
164+
expect(result).toThrowErrorMatchingSnapshot();
165165
});
166166

167167
test('new Reader([]): throws on empty array', () => {
168168
expect.assertions(1);
169169
const result = () => new Reader([]);
170-
expect(result).toThrow();
170+
expect(result).toThrowErrorMatchingSnapshot();
171171
});
172172

173173
test('new Reader([1,2,3]): throws on array containing non stream items', () => {
174174
expect.assertions(1);
175175
const result = () => new Reader([1, 2, 3]);
176-
expect(result).toThrow();
176+
expect(result).toThrowErrorMatchingSnapshot();
177177
});
178178

179179
test('SortAndDedupe() rows without id value dropped', done => {

0 commit comments

Comments
 (0)