createStream.js
1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* eslint-disable max-nested-callbacks */
import {
expect
} from 'chai';
import createStream from './../src/createStream';
describe('createStream', () => {
context('"config.columnDefault.width" property is not provided', () => {
it('throws an error', () => {
expect(() => {
createStream();
}).to.throw(Error, 'Must provide config.columnDefault.width when creating a stream.');
});
});
context('"config.columnCount" property is not provided', () => {
it('throws an error', () => {
expect(() => {
createStream({
columnDefault: {
width: 10
}
});
}).to.throw(Error, 'Must provide config.columnCount.');
});
});
context('Table data cell count does not match the columnCount.', () => {
it('throws an error', () => {
expect(() => {
const stream = createStream({
columnCount: 10,
columnDefault: {
width: 10
}
});
stream.write(['foo']);
}).to.throw(Error, 'Row cell count does not match the config.columnCount.');
});
});
});