Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
geoperez committed Nov 9, 2023
1 parent 0aea8a7 commit 1e17e88
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
2 changes: 1 addition & 1 deletion jest-setup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ jest.mock('recharts', () => {
</OriginalModule.ResponsiveContainer>
),
};
});
});
16 changes: 16 additions & 0 deletions src/ComposedLineChart/ComposedLineChart.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react';
import { render } from '@testing-library/react';
import { ComposedLineChart } from './index';
import { identity } from 'uno-js';

describe('ComposedLineChart', () => {
const data = [
{ name: 'A', value: 10 },
{ name: 'B', value: 20 },
{ name: 'C', value: 30 },
];

it('renders without crashing', () => {
render(<ComposedLineChart rawData={data} dataCallback={identity} lines={[{ dataKey: 'name', yAxisId: 'left' }]} />);
});
});
10 changes: 10 additions & 0 deletions src/DataChart/DataChart.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react';
import { render } from '@testing-library/react';
import { DataChart } from './index';
import { identity } from 'uno-js';

describe('DataChart', () => {
it('renders without crashing', () => {
render(<DataChart rawData={[]} dataCallback={identity} />);
});
});
10 changes: 9 additions & 1 deletion src/Table/Table.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { getAlignment, renderTableCell, Table, TableColumn } from './index';
import { getAlignment, renderTableCell, Table, TableCellTypes, TableColumn } from './index';
import { render } from '@testing-library/react';
import { identity } from 'uno-js';

Expand Down Expand Up @@ -116,6 +116,14 @@ describe('Table', () => {
render(<Table columns={tableColumns} rawData={tableData} dataCallback={identity} />);
});

it('renders with shimmer', () => {
const data: undefined | TableCellTypes[][] = undefined;
const { container } = render(<Table columns={tableColumns} rawData={data} dataCallback={(x: undefined | TableCellTypes[][]) => []} />);

const shimmer = container.querySelector('.loading-shimmer');
expect(shimmer).toBeInTheDocument();
});

it('renders the correct number of rows', () => {
const { container } = render(<Table columns={tableColumns} rawData={tableData} dataCallback={identity} />);
const rows = container.querySelectorAll('tbody .tremor-TableRow-row');
Expand Down

0 comments on commit 1e17e88

Please sign in to comment.