1
0
mirror of https://github.com/thangisme/notes.git synced 2024-11-16 21:15:58 -05:00
notes/node_modules/table/test/createStream.js

42 lines
1.1 KiB
JavaScript
Raw Normal View History

2017-03-09 13:16:08 -05:00
/* 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.');
});
});
});