Replace @testing-library/jest-dom with built-in vitest browser assertions

This commit is contained in:
Alejandro Celaya
2026-08-16 19:32:41 +02:00
parent ba73644871
commit 585d7c6f63
30 changed files with 305 additions and 429 deletions

View File

@@ -13,22 +13,22 @@ describe('<ShlinkLogo />', () => {
[undefined, brandColor()],
['red', 'red'],
['white', 'white'],
])('renders expected color', (color, expectedColor) => {
])('renders expected color', async (color, expectedColor) => {
const { container } = setUp({ color });
expect(container.querySelector('g')).toHaveAttribute('fill', expectedColor);
await expect.element(container.querySelector('g')).toHaveAttribute('fill', expectedColor);
});
it.each([
[undefined, undefined],
['foo', 'foo'],
['bar', 'bar'],
])('renders expected class', (className, expectedClassName) => {
])('renders expected class', async (className, expectedClassName) => {
const { container } = setUp({ className });
if (expectedClassName) {
expect(container.firstChild).toHaveAttribute('class', expectedClassName);
await expect.element(container.firstChild as HTMLElement).toHaveAttribute('class', expectedClassName);
} else {
expect(container.firstChild).not.toHaveAttribute('class');
await expect.element(container.firstChild as HTMLElement).not.toHaveAttribute('class');
}
});
});