helper.spec.js 716 B

12345678910111213141516171819202122
  1. import expect from 'expect';
  2. import {buildSheetFromMatrix} from './../../src/helpers';
  3. describe('node-xlsx helper', () => {
  4. describe('buildSheetFromMatrix', () => {
  5. it('should throw if row data is not array', () => {
  6. const notArrayData = [['a1'], {val: 'b1'}];
  7. expect(() => buildSheetFromMatrix(notArrayData)).toThrow();
  8. });
  9. it('should throw if sheet data is not array', () => {
  10. const notArrayData = {val: 'a1'};
  11. expect(() => buildSheetFromMatrix(notArrayData)).toThrow();
  12. });
  13. it('should not throw if data is valid array', () => {
  14. const notArrayData = [['a1'], ['b1']];
  15. expect(typeof buildSheetFromMatrix(notArrayData)).toBe('object');
  16. });
  17. });
  18. });