Merge pull request #14175 from strapi/fix/test-prop-types

chore: Fix some test errors
This commit is contained in:
Gustav Hansen 2022-08-23 15:44:22 +02:00 committed by GitHub
commit bd14f60980
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 23 additions and 10 deletions

View File

@ -31,7 +31,7 @@ exports[`DynamicTabe / Cellcontent / RelationSingle renders and matches the snap
<span <span
class="c0 c1" class="c0 c1"
> >
1
</span> </span>
<div <div
class="c2" class="c2"

View File

@ -15,7 +15,7 @@ const DEFAULT_PROPS_FIXTURE = {
}, },
}, },
value: { value: {
count: 1, name: 1,
}, },
}; };

View File

@ -17,6 +17,7 @@ describe('<AddComponentButton />', () => {
<IntlProvider locale="en" messages={{}} defaultLocale="en"> <IntlProvider locale="en" messages={{}} defaultLocale="en">
<AddComponentButton <AddComponentButton
label="test" label="test"
isDisabled={false}
isOpen={false} isOpen={false}
name="name" name="name"
onClick={jest.fn()} onClick={jest.fn()}
@ -38,6 +39,7 @@ describe('<AddComponentButton />', () => {
<AddComponentButton <AddComponentButton
label="test" label="test"
isOpen isOpen
isDisabled={false}
name="name" name="name"
onClick={jest.fn()} onClick={jest.fn()}
hasError={false} hasError={false}
@ -58,6 +60,7 @@ describe('<AddComponentButton />', () => {
<AddComponentButton <AddComponentButton
label="" label=""
isOpen={false} isOpen={false}
isDisabled={false}
name="name" name="name"
onClick={jest.fn()} onClick={jest.fn()}
hasError={false} hasError={false}

View File

@ -8,7 +8,7 @@ import UseCasePage from '../index';
jest.mock('../../../components/LocalesProvider/useLocalesProvider', () => () => ({ jest.mock('../../../components/LocalesProvider/useLocalesProvider', () => () => ({
changeLocale() {}, changeLocale() {},
localeNames: ['en'], localeNames: { en: 'English' },
messages: ['test'], messages: ['test'],
})); }));
jest.mock('../../../hooks/useConfigurations', () => () => ({ jest.mock('../../../hooks/useConfigurations', () => () => ({
@ -734,11 +734,14 @@ describe('Admin | UseCasePage', () => {
aria-expanded="false" aria-expanded="false"
aria-haspopup="true" aria-haspopup="true"
class="c2 c3" class="c2 c3"
label="English"
type="button" type="button"
> >
<span <span
class="c4 c5" class="c4 c5"
/> >
English
</span>
<div <div
aria-hidden="true" aria-hidden="true"
class="c6 c7" class="c6 c7"

View File

@ -248,6 +248,7 @@ exports[`Media Library | Breadcrumbs should render and match snapshot 1`] = `
<div> <div>
<nav <nav
aria-label="Navigation"
class="c0 " class="c0 "
> >
<ol <ol

View File

@ -40,7 +40,7 @@ const setup = (props) =>
<MemoryRouter> <MemoryRouter>
<IntlProvider locale="en" messages={{}}> <IntlProvider locale="en" messages={{}}>
<ThemeProvider theme={lightTheme}> <ThemeProvider theme={lightTheme}>
<Breadcrumbs breadcrumbs={defaultBreadcrumbs} as="nav" {...props} /> <Breadcrumbs breadcrumbs={defaultBreadcrumbs} label="Navigation" as="nav" {...props} />
</ThemeProvider> </ThemeProvider>
</IntlProvider> </IntlProvider>
</MemoryRouter> </MemoryRouter>

View File

@ -77,7 +77,13 @@ export const AssetDefinition = PropTypes.shape({
export const CrumbDefinition = PropTypes.shape({ export const CrumbDefinition = PropTypes.shape({
id: PropTypes.number, id: PropTypes.number,
label: PropTypes.string.isRequired, label: PropTypes.oneOfType([
PropTypes.string,
PropTypes.shape({
id: PropTypes.string.isRequired,
defaultMessage: PropTypes.string.isRequired,
}),
]).isRequired,
href: PropTypes.string, href: PropTypes.string,
}); });

View File

@ -10,7 +10,7 @@ export const useFolder = jest.fn().mockReturnValue({
count: 1, count: 1,
}, },
path: '/1', path: '/1',
pathId: '1', pathId: 1,
updatedAt: '', updatedAt: '',
parent: { parent: {
id: 2, id: 2,
@ -23,7 +23,7 @@ export const useFolder = jest.fn().mockReturnValue({
count: 1, count: 1,
}, },
path: '/1', path: '/1',
pathId: '1', pathId: 1,
updatedAt: '', updatedAt: '',
}, },
}, },

View File

@ -24,7 +24,7 @@ const FIXTURE_FOLDER = {
count: 1, count: 1,
}, },
path: '/1', path: '/1',
pathId: '1', pathId: 1,
updatedAt: '', updatedAt: '',
parent: { parent: {
id: 2, id: 2,
@ -37,7 +37,7 @@ const FIXTURE_FOLDER = {
count: 1, count: 1,
}, },
path: '/1', path: '/1',
pathId: '1', pathId: 1,
updatedAt: '', updatedAt: '',
}, },
}; };