import React from 'react' import { render } from '@testing-library/react' import { TableCard, TableContainer, TableHeader, TableHeaderRowCell, TableRow, TableRowCell, } from './Table' enum TestId { tableContainer = 'table-container', tableHeader = 'table-header', tableHeaderRow = 'table-header-row', tableHeaderRowCell = 'table-header-row-cell', tableCard = 'table-card', tableRow = 'table-row', tableRowCell = 'table-row-cell', } /** * Simple Wrapper with absolute bare basics. * Although we use data-automation-id in practice, * I have opted with data-testid for quick validation. * I will leave it up to team DS if they want to * change the config if they wish. * * @see https://testing-library.com/docs/dom-testing-library/api-helpers#custom-queries */ const Wrapper = (): JSX.Element => ( undefined} onClick={(): void => undefined} labelText="Resource name" width={12 / 12} data-testid={TestId.tableHeaderRowCell} /> alert('clicked!')}>
) describe('', () => { describe('Custom HTML props', () => { for (const [key, value] of Object.entries(TestId)) { it(`${key} accepts custom data-* attributes`, () => { const { getByTestId } = render() expect(getByTestId(value)).toBeTruthy() }) } }) })