Sha256: 92ebb6d0ea200258f3682ed6b22fe6a53f88fd46ca6eed46d211abf3c92e5e00
Contents?: true
Size: 1.65 KB
Versions: 46
Compression:
Stored size: 1.65 KB
Contents
/* eslint-disable max-nested-callbacks */ import { expect } from 'chai'; import validateTableData from './../src/validateTableData'; describe('validateTableData', () => { context('table does not have a row', () => { it('throws an error', () => { expect(() => { validateTableData([]); }).to.throw(Error, 'Table must define at least one row.'); }); }); context('table does not have a column', () => { it('throws an error', () => { expect(() => { validateTableData([[]]); }).to.throw(Error, 'Table must define at least one column.'); }); }); context('row data is not an array', () => { it('throws an error', () => { expect(() => { validateTableData({}); }).to.throw(Error, 'Table data must be an array.'); }); }); context('column data is not an array', () => { it('throws an error', () => { expect(() => { validateTableData([{}]); }).to.throw(Error, 'Table row data must be an array.'); }); }); context('cell data contains a control character', () => { it('throws an error', () => { expect(() => { validateTableData([ [ [ String.fromCodePoint(0x01) ] ] ]); }).to.throw(Error, 'Table data must not contain control characters.'); }); }); context('rows have inconsistent number of cells', () => { it('throws an error', () => { expect(() => { validateTableData([ ['a', 'b', 'c'], ['a', 'b'] ]); }).to.throw(Error, 'Table must have a consistent number of cells.'); }); }); });
Version data entries
46 entries across 46 versions & 3 rubygems