diff --git a/src/CardLoading/CardLoading.spec.tsx b/src/CardLoading/CardLoading.spec.tsx new file mode 100644 index 0000000..8e93131 --- /dev/null +++ b/src/CardLoading/CardLoading.spec.tsx @@ -0,0 +1,10 @@ +import React from 'react'; +import { render } from '@testing-library/react'; +import { CardLoading } from './index'; + +describe('CardLoading', () => { + it('renders without crashing', () => { + const { container } = render(); + expect(container.firstChild).toBeInTheDocument(); + }); +}); \ No newline at end of file diff --git a/src/Menu/Menu.spec.tsx b/src/Menu/Menu.spec.tsx new file mode 100644 index 0000000..d3c9991 --- /dev/null +++ b/src/Menu/Menu.spec.tsx @@ -0,0 +1,17 @@ +import React from 'react'; +import { render, fireEvent } from '@testing-library/react'; +import { Burger } from './index'; + +describe('Burger', () => { + it('renders without crashing', () => { + const { container } = render( { }} />); + expect(container.firstChild).toBeInTheDocument(); + }); + + it('calls onClick when clicked', () => { + const handleClick = jest.fn(); + const { container } = render(); + fireEvent.click(container.firstChild as Element); + expect(handleClick).toHaveBeenCalledTimes(1); + }); +}); \ No newline at end of file diff --git a/src/Table/Table.spec.tsx b/src/Table/Table.spec.tsx index a8d3769..fb9cddd 100644 --- a/src/Table/Table.spec.tsx +++ b/src/Table/Table.spec.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { getAlignment, renderTableCell, Table, TableCellTypes, TableColumn } from './index'; +import { getAlignment, getColumnSorting, renderTableCell, Table, TableCellTypes, TableColumn } from './index'; import { render } from '@testing-library/react'; import { identity } from 'uno-js'; @@ -30,6 +30,14 @@ describe('getAlignment', () => { }); }); +describe('getColumnSorting', () => { + it('returns 1 when the column is sortable', () => { + const tableColumn: TableColumn[] = [{ label: 'column', sortOrder: 1, sortDirection: 'asc' }]; + expect(getColumnSorting(tableColumn, 0)[0].sortOrder).toBe(1); + expect(getColumnSorting(tableColumn, 0)[0].sortDirection).toBe('desc'); + }); +}); + describe('renderTableCell', () => { it('renders a paragraph when the data type is paragraph', () => { const tableColumn: TableColumn = { label: 'column', dataType: 'paragraph' }; @@ -90,7 +98,7 @@ describe('renderTableCell', () => { describe('Table', () => { const tableColumns: TableColumn[] = [ - { label: 'Column 1', dataType: 'string' }, + { label: 'Column 1', dataType: 'string', sortOrder: 1, sortDirection: 'asc' }, { label: 'Column 2', dataType: 'number' }, { label: 'Column 3', dataType: 'money' }, { label: 'Column 4', dataType: 'date' }, diff --git a/src/UnoLogo/UnoLogo.spec.tsx b/src/UnoLogo/UnoLogo.spec.tsx new file mode 100644 index 0000000..da9d37f --- /dev/null +++ b/src/UnoLogo/UnoLogo.spec.tsx @@ -0,0 +1,10 @@ +import React from 'react'; +import { render } from '@testing-library/react'; +import { UnoLogo } from './index'; + +describe('UnoLogo', () => { + it('renders without crashing', () => { + const { container } = render(); + expect(container.firstChild).toBeInTheDocument(); + }); +}); \ No newline at end of file