ReportWidget.test.tsx33 lines · main
| 1 | import { screen } from '@testing-library/react' |
| 2 | import { test } from 'vitest' |
| 3 | |
| 4 | import { render } from '../../helpers' |
| 5 | import ReportWidget from '@/components/interfaces/Reports/ReportWidget' |
| 6 | |
| 7 | test('static elements', async () => { |
| 8 | render( |
| 9 | <ReportWidget |
| 10 | isLoading={false} |
| 11 | data={[]} |
| 12 | title="Some chart" |
| 13 | resolvedSql="select" |
| 14 | renderer={() => 'something'} |
| 15 | /> |
| 16 | ) |
| 17 | await screen.findByText(/something/) |
| 18 | await screen.findByText(/Some chart/) |
| 19 | }) |
| 20 | |
| 21 | test('append', async () => { |
| 22 | const appendable = () => 'some text' |
| 23 | render( |
| 24 | <ReportWidget |
| 25 | title="hola" |
| 26 | isLoading={false} |
| 27 | data={[]} |
| 28 | renderer={() => null} |
| 29 | append={appendable} |
| 30 | /> |
| 31 | ) |
| 32 | await screen.findByText(/some text/) |
| 33 | }) |