1
0
mirror of https://github.com/thangisme/notes.git synced 2024-12-22 20:16:54 -05:00
notes/node_modules/table/test/createStream.js
Patrick Marsceill b7b0d0d7bf
Initial commit
2017-03-09 13:16:08 -05:00

42 lines
1.1 KiB
JavaScript

/* 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.');
});
});
});