test: rename test and remove useless nav wrapper

This commit is contained in:
Sammy Teillet
2023-04-19 14:25:27 +02:00
parent b434f3da45
commit 97457f54cb
2 changed files with 4 additions and 10 deletions

View File

@ -1,5 +1,3 @@
import { MemoryRouter } from 'react-router-dom';
import CompanyChip from '../CompanyChip'; import CompanyChip from '../CompanyChip';
import { ThemeProvider } from '@emotion/react'; import { ThemeProvider } from '@emotion/react';
import { lightTheme } from '../../../layout/styles/themes'; import { lightTheme } from '../../../layout/styles/themes';
@ -12,9 +10,7 @@ export default {
export const RegularCompanyChip = () => { export const RegularCompanyChip = () => {
return ( return (
<ThemeProvider theme={lightTheme}> <ThemeProvider theme={lightTheme}>
<MemoryRouter initialEntries={['/companies']}> <CompanyChip name="selected-company-1" />
<CompanyChip name="selected-company-1" />
</MemoryRouter>
</ThemeProvider> </ThemeProvider>
); );
}; };
@ -22,9 +18,7 @@ export const RegularCompanyChip = () => {
export const RegularCompanyChipWithImage = () => { export const RegularCompanyChipWithImage = () => {
return ( return (
<ThemeProvider theme={lightTheme}> <ThemeProvider theme={lightTheme}>
<MemoryRouter initialEntries={['/companies']}> <CompanyChip name="selected-company-1" picture="coucou.fr" />
<CompanyChip name="selected-company-1" picture="coucou.fr" />
</MemoryRouter>
</ThemeProvider> </ThemeProvider>
); );
}; };

View File

@ -5,13 +5,13 @@ import {
RegularCompanyChipWithImage, RegularCompanyChipWithImage,
} from '../__stories__/CompanyChip'; } from '../__stories__/CompanyChip';
it('Checks the NavItem renders', () => { it('Checks the CompanyChip renders', () => {
const { getByText } = render(<RegularCompanyChip />); const { getByText } = render(<RegularCompanyChip />);
expect(getByText('selected-company-1')).toBeDefined(); expect(getByText('selected-company-1')).toBeDefined();
}); });
it('Checks the img renders', () => { it('Checks the CompanyChip img renders', () => {
const { getByTestId } = render(<RegularCompanyChipWithImage />); const { getByTestId } = render(<RegularCompanyChipWithImage />);
expect(getByTestId('company-chip-image')).toHaveAttribute('src', 'coucou.fr'); expect(getByTestId('company-chip-image')).toHaveAttribute('src', 'coucou.fr');