Skip to content

Commit 3c13140

Browse files
committed
FE: Fix tests
1 parent de43a98 commit 3c13140

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

frontend/src/components/common/NewTable/__test__/Table.spec.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,10 @@ describe('Table', () => {
282282
});
283283
expect(screen.getAllByRole('row').length).toEqual(data.length + 1);
284284
const th = screen.getByRole('columnheader', { name: 'Text' });
285+
const sortingElement = screen.getByText('Text');
286+
285287
expect(th).toBeInTheDocument();
288+
expect(sortingElement).toBeInTheDocument();
286289

287290
let rows = screen.getAllByRole('row');
288291
// Check initial sort order by text column is descending
@@ -293,15 +296,15 @@ describe('Table', () => {
293296
expect(rows[1].textContent?.indexOf('sit')).toBeGreaterThan(-1);
294297

295298
// Disable sorting by text column
296-
await userEvent.click(th);
299+
await userEvent.click(sortingElement);
297300
rows = screen.getAllByRole('row');
298301
expect(rows[1].textContent?.indexOf('lorem')).toBeGreaterThan(-1);
299302
expect(rows[2].textContent?.indexOf('ipsum')).toBeGreaterThan(-1);
300303
expect(rows[3].textContent?.indexOf('dolor')).toBeGreaterThan(-1);
301304
expect(rows[4].textContent?.indexOf('sit')).toBeGreaterThan(-1);
302305

303306
// Sort by text column ascending
304-
await userEvent.click(th);
307+
await userEvent.click(sortingElement);
305308
rows = screen.getAllByRole('row');
306309
expect(rows[1].textContent?.indexOf('dolor')).toBeGreaterThan(-1);
307310
expect(rows[2].textContent?.indexOf('ipsum')).toBeGreaterThan(-1);

0 commit comments

Comments
 (0)