import { render } from '@testing-library/react'; import Table from './index'; const mockColumns = [ { key: 'name', label: 'Name', }, { key: 'job', label: 'Occupation', }, { key: 'hobbies', label: 'Fun', }, ]; const tableData = [ { id: 123, name: 'Chan', job: 'CEO', hobbies: 'basketball', }, { id: 312, name: 'Chow', job: 'Hobo', hobbies: 'hockey', }, { id: 352, name: 'Mannings', job: 'Carpenter', hobbies: 'football', }, { id: 24523, name: 'Wong', job: 'Business man', hobbies: 'buy', }, { id: 47657, name: 'Smith', job: 'Janitor', hobbies: 'eat', }, { id: 5675, name: 'Trump', job: 'PUTUS', hobbies: 'sit', }, ]; test('not crash', () => { expect(() => ).not.toThrow(); }); describe('snapshots', () => { test('basic', () => { const { asFragment } = render(
); expect(asFragment()).toMatchSnapshot(); }); test('align', () => { const tcols = [ { key: 'id', label: 'hmnn' }, { key: 'propL', label: 'hmnn', align: 'left' as 'left' }, { key: 'propC', label: 'Blah', align: 'center' as 'center' }, { key: 'propR', label: 'hmnn', align: 'right' as 'right' }, { key: 'propJ', label: 'Blah', align: 'justify' as 'justify' }, ]; const tdata = [ { id: '123s', propL: 'left', propC: 'center', propR: 'right', propJ: 'justify', }, { id: '123e', propL: 'left', propC: 'center', propR: 'right', propJ: 'justify', }, { id: '123w', propL: 'left', propC: 'center', propR: 'right', propJ: 'justify', }, ]; const { asFragment } = render(
); expect(asFragment()).toMatchSnapshot(); }); });