mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-18 13:33:51 +00:00
Move shlink-web-component tests to their own folder
This commit is contained in:
21
shlink-web-component/test/visits/VisitsHeader.test.tsx
Normal file
21
shlink-web-component/test/visits/VisitsHeader.test.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { fromPartial } from '@total-typescript/shoehorn';
|
||||
import type { Visit } from '../../src/visits/types';
|
||||
import { VisitsHeader } from '../../src/visits/VisitsHeader';
|
||||
|
||||
describe('<VisitsHeader />', () => {
|
||||
const visits: Visit[] = [fromPartial({}), fromPartial({}), fromPartial({})];
|
||||
const title = 'My header title';
|
||||
const goBack = vi.fn();
|
||||
const setUp = () => render(<VisitsHeader visits={visits} goBack={goBack} title={title} />);
|
||||
|
||||
it('shows the amount of visits', () => {
|
||||
const { container } = setUp();
|
||||
expect(container.querySelector('.badge')).toHaveTextContent(`Visits: ${visits.length}`);
|
||||
});
|
||||
|
||||
it('shows the title in two places', () => {
|
||||
setUp();
|
||||
expect(screen.getAllByText(title)).toHaveLength(2);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user