mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-10-21 13:14:10 +00:00
Replace direct rendering with react testing library by vitest-browser-react
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { brandColor } from '@shlinkio/shlink-frontend-kit';
|
||||
import { render } from '@testing-library/react';
|
||||
import type { ShlinkLogoProps } from '../../../src/common/img/ShlinkLogo';
|
||||
import { ShlinkLogo } from '../../../src/common/img/ShlinkLogo';
|
||||
import { checkAccessibility } from '../../__helpers__/accessibility';
|
||||
import { render } from '../../__helpers__/setUpTest.tsx';
|
||||
|
||||
describe('<ShlinkLogo />', () => {
|
||||
const setUp = (props: ShlinkLogoProps = {}) => render(<ShlinkLogo {...props} />);
|
||||
@@ -14,7 +14,7 @@ describe('<ShlinkLogo />', () => {
|
||||
['red', 'red'],
|
||||
['white', 'white'],
|
||||
])('renders expected color', async (color, expectedColor) => {
|
||||
const { container } = setUp({ color });
|
||||
const { container } = await setUp({ color });
|
||||
await expect.element(container.querySelector('g')).toHaveAttribute('fill', expectedColor);
|
||||
});
|
||||
|
||||
@@ -23,7 +23,7 @@ describe('<ShlinkLogo />', () => {
|
||||
['foo', 'foo'],
|
||||
['bar', 'bar'],
|
||||
])('renders expected class', async (className, expectedClassName) => {
|
||||
const { container } = setUp({ className });
|
||||
const { container } = await setUp({ className });
|
||||
|
||||
if (expectedClassName) {
|
||||
await expect.element(container.firstChild as HTMLElement).toHaveAttribute('class', expectedClassName);
|
||||
|
||||
Reference in New Issue
Block a user