diff --git a/packages/strapi-admin/admin/src/containers/Admin/tests/index.test.js b/packages/strapi-admin/admin/src/containers/Admin/tests/index.test.js index 28a1a2bfab..384503a79a 100644 --- a/packages/strapi-admin/admin/src/containers/Admin/tests/index.test.js +++ b/packages/strapi-admin/admin/src/containers/Admin/tests/index.test.js @@ -36,6 +36,9 @@ describe('', () => { strapiVersion: '3', uuid: false, }, + intl: { + formatMessage: jest.fn(), + }, location: {}, setAppError: jest.fn(), showGlobalAppBlocker: jest.fn(), diff --git a/packages/strapi-plugin-content-manager/admin/src/containers/ListView/index.js b/packages/strapi-plugin-content-manager/admin/src/containers/ListView/index.js index 3a9878d2f8..828f2c3eab 100644 --- a/packages/strapi-plugin-content-manager/admin/src/containers/ListView/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/containers/ListView/index.js @@ -190,6 +190,7 @@ function ListView({ }, }); } + onChangeListLabels({ target: { name, diff --git a/packages/strapi-plugin-content-manager/admin/src/containers/Main/tests/reducer.test.js b/packages/strapi-plugin-content-manager/admin/src/containers/Main/tests/reducer.test.js index 69a8b0feb4..c41c9d1f47 100644 --- a/packages/strapi-plugin-content-manager/admin/src/containers/Main/tests/reducer.test.js +++ b/packages/strapi-plugin-content-manager/admin/src/containers/Main/tests/reducer.test.js @@ -16,34 +16,42 @@ describe('Content Manager | Main | reducer', () => { components: [], initialLayouts: { test: { - layouts: { - edit: [], - editRelations: [], - list: ['test'], + contentType: { + layouts: { + edit: [], + editRelations: [], + list: ['test'], + }, }, }, otherTest: { - layouts: { - edit: [], - editRelations: [], - list: ['otherTest'], + contentType: { + layouts: { + edit: [], + editRelations: [], + list: ['otherTest'], + }, }, }, }, isLoading: true, layouts: { test: { - layouts: { - edit: [], - editRelations: [], - list: ['test'], + contentType: { + layouts: { + edit: [], + editRelations: [], + list: ['test'], + }, }, }, otherTest: { - layouts: { - edit: [], - editRelations: [], - list: ['otherTest'], + contentType: { + layouts: { + edit: [], + editRelations: [], + list: ['otherTest'], + }, }, }, }, @@ -55,7 +63,11 @@ describe('Content Manager | Main | reducer', () => { const expected = { ...state, layouts: { - test: { layouts: { edit: [], editRelations: [], list: ['test'] } }, + test: { + contentType: { + layouts: { edit: [], editRelations: [], list: ['test'] }, + }, + }, }, }; @@ -72,17 +84,23 @@ describe('Content Manager | Main | reducer', () => { }); it('should handle the resetListLabels action correctly', () => { - state.layouts.test.layouts.list.push('label'); + state.layouts.test.contentType.layouts.list.push('label'); const expected = { ...state, layouts: { - test: { layouts: { edit: [], editRelations: [], list: ['test'] } }, + test: { + contentType: { + layouts: { edit: [], editRelations: [], list: ['test'] }, + }, + }, otherTest: { - layouts: { - edit: [], - editRelations: [], - list: ['otherTest'], + contentType: { + layouts: { + edit: [], + editRelations: [], + list: ['otherTest'], + }, }, }, }, @@ -99,34 +117,12 @@ describe('Content Manager | Main | reducer', () => { layouts: { ...state.layouts, otherTest: { - layouts: { - edit: [], - editRelations: [], - list: ['otherTest', 'foo'], - }, - }, - }, - }; - - expect( - mainReducer( - fromJS(state), - onChangeListLabels({ target: { name: 'otherTest.foo', value: true } }) - ).toJS() - ).toEqual(expected); - }); - - it('should handle the onChangeListLabels action correctly when removing a label', () => { - state.layouts.otherTest.layouts.list = ['otherTest', 'foo']; - const expected = { - ...state, - layouts: { - ...state.layouts, - otherTest: { - layouts: { - edit: [], - editRelations: [], - list: ['foo'], + contentType: { + layouts: { + edit: [], + editRelations: [], + list: ['otherTest', 'foo'], + }, }, }, }, @@ -136,7 +132,39 @@ describe('Content Manager | Main | reducer', () => { mainReducer( fromJS(state), onChangeListLabels({ - target: { name: 'otherTest.otherTest', value: false }, + target: { name: 'foo', slug: 'otherTest', value: true }, + }) + ).toJS() + ).toEqual(expected); + }); + + it('should handle the onChangeListLabels action correctly when removing a label', () => { + state.layouts.otherTest.contentType.layouts.list = ['otherTest', 'foo']; + const expected = { + ...state, + layouts: { + ...state.layouts, + otherTest: { + contentType: { + layouts: { + edit: [], + editRelations: [], + list: ['foo'], + }, + }, + }, + }, + }; + + expect( + mainReducer( + fromJS(state), + onChangeListLabels({ + target: { + name: 'otherTest', + slug: 'otherTest', + value: false, + }, }) ).toJS() ).toEqual(expected); diff --git a/packages/strapi-plugin-content-manager/admin/src/containers/EditView/utils/tests/getComponents.test.js b/packages/strapi-plugin-content-manager/admin/src/utils/tests/getComponents.test.js similarity index 100% rename from packages/strapi-plugin-content-manager/admin/src/containers/EditView/utils/tests/getComponents.test.js rename to packages/strapi-plugin-content-manager/admin/src/utils/tests/getComponents.test.js diff --git a/packages/strapi-plugin-content-type-builder/admin/src/InjectedComponents/ContentManager/tests/EditViewLink.test.js b/packages/strapi-plugin-content-type-builder/admin/src/InjectedComponents/ContentManager/tests/EditViewLink.test.js index feb9505a70..a252f3a4d3 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/InjectedComponents/ContentManager/tests/EditViewLink.test.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/InjectedComponents/ContentManager/tests/EditViewLink.test.js @@ -28,19 +28,4 @@ describe('', () => { expect(liLink).toHaveLength(0); }); - - it('should handle the source correctly if it is undefined', () => { - const wrapper = shallow(); - const liLink = wrapper.find(LiLink); - - expect(liLink.prop('url')).toBe('/plugins/test'); - }); - - it('should handle the source correctly if it is not undefined', () => { - props.getSource = jest.fn(() => 'users-permissions'); - const wrapper = shallow(); - const liLink = wrapper.find(LiLink); - - expect(liLink.prop('url')).toBe('/plugins/test&source=users-permissions'); - }); }); diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/App/tests/__snapshots__/Loader.test.js.snap b/packages/strapi-plugin-content-type-builder/admin/src/containers/App/tests/__snapshots__/Loader.test.js.snap index 829555e417..f4f0852d2b 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/containers/App/tests/__snapshots__/Loader.test.js.snap +++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/App/tests/__snapshots__/Loader.test.js.snap @@ -2,13 +2,13 @@ exports[` should not crash 1`] = `