Fix tests after initial tailwind components migration

This commit is contained in:
Alejandro Celaya
2025-04-02 09:33:28 +02:00
parent a63c214d8d
commit 7c31b210bd
6 changed files with 67 additions and 46 deletions

View File

@@ -1,3 +1,4 @@
import { Table } from '@shlinkio/shlink-frontend-kit/tailwind';
import { render, screen } from '@testing-library/react';
import { fromPartial } from '@total-typescript/shoehorn';
import { MemoryRouter } from 'react-router';
@@ -17,11 +18,9 @@ describe('<ManageServersRow />', () => {
};
const setUp = (hasAutoConnect = false, autoConnect = false) => render(
<MemoryRouter>
<table>
<tbody>
<ManageServersRow server={{ ...server, autoConnect }} hasAutoConnect={hasAutoConnect} />
</tbody>
</table>
<Table header={<Table.Row />}>
<ManageServersRow server={{ ...server, autoConnect }} hasAutoConnect={hasAutoConnect} />
</Table>
</MemoryRouter>,
);
@@ -32,11 +31,7 @@ describe('<ManageServersRow />', () => {
[false, 3],
])('renders expected amount of columns', (hasAutoConnect, expectedCols) => {
setUp(hasAutoConnect);
const td = screen.getAllByRole('cell');
const th = screen.getAllByRole('columnheader');
expect(td.length + th.length).toEqual(expectedCols);
expect(screen.getAllByRole('cell')).toHaveLength(expectedCols);
});
it('renders a dropdown', () => {