mirror of
https://github.com/strapi/strapi.git
synced 2025-11-12 08:08:05 +00:00
Fix tests
Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
parent
b4921dc967
commit
dd71bf28ef
@ -9,13 +9,8 @@ const selectApp = () => state => state.app;
|
|||||||
* Select the language locale
|
* Select the language locale
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const selectPlugins = () => createSelector(selectApp(), appState => appState.get('plugins'));
|
|
||||||
|
|
||||||
const makeSelectApp = () => createSelector(selectApp(), appState => appState.toJS());
|
const makeSelectApp = () => createSelector(selectApp(), appState => appState.toJS());
|
||||||
|
|
||||||
const selectHasUserPlugin = () =>
|
|
||||||
createSelector(selectApp(), appState => appState.get('hasUserPlugin'));
|
|
||||||
|
|
||||||
const makeSelectShowGlobalAppBlocker = () =>
|
const makeSelectShowGlobalAppBlocker = () =>
|
||||||
createSelector(selectApp(), appState => appState.get('showGlobalAppBlocker'));
|
createSelector(selectApp(), appState => appState.get('showGlobalAppBlocker'));
|
||||||
|
|
||||||
@ -24,15 +19,10 @@ const makeSelectBlockApp = () => createSelector(selectApp(), appState => appStat
|
|||||||
const makeSelectOverlayBlockerProps = () =>
|
const makeSelectOverlayBlockerProps = () =>
|
||||||
createSelector(selectApp(), appState => appState.get('overlayBlockerData'));
|
createSelector(selectApp(), appState => appState.get('overlayBlockerData'));
|
||||||
|
|
||||||
const makeSelectUuid = () => createSelector(selectApp(), appState => appState.get('uuid'));
|
|
||||||
|
|
||||||
export default makeSelectApp;
|
export default makeSelectApp;
|
||||||
export {
|
export {
|
||||||
selectApp,
|
selectApp,
|
||||||
selectHasUserPlugin,
|
|
||||||
selectPlugins,
|
|
||||||
makeSelectBlockApp,
|
makeSelectBlockApp,
|
||||||
makeSelectOverlayBlockerProps,
|
makeSelectOverlayBlockerProps,
|
||||||
makeSelectShowGlobalAppBlocker,
|
makeSelectShowGlobalAppBlocker,
|
||||||
makeSelectUuid,
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -2,21 +2,18 @@ import { fromJS } from 'immutable';
|
|||||||
|
|
||||||
import makeSelectApp, {
|
import makeSelectApp, {
|
||||||
selectApp,
|
selectApp,
|
||||||
selectHasUserPlugin,
|
|
||||||
selectPlugins,
|
|
||||||
makeSelectBlockApp,
|
makeSelectBlockApp,
|
||||||
makeSelectOverlayBlockerProps,
|
makeSelectOverlayBlockerProps,
|
||||||
makeSelectShowGlobalAppBlocker,
|
makeSelectShowGlobalAppBlocker,
|
||||||
makeSelectUuid,
|
|
||||||
} from '../selectors';
|
} from '../selectors';
|
||||||
|
|
||||||
describe('<App /> selectors', () => {
|
describe('<App /> selectors', () => {
|
||||||
describe('selectApp', () => {
|
describe('selectApp', () => {
|
||||||
it('should select the global state', () => {
|
it('should select the global state', () => {
|
||||||
const appState = fromJS({});
|
const appState = fromJS({});
|
||||||
const mockedState = fromJS({
|
const mockedState = {
|
||||||
app: appState,
|
app: appState,
|
||||||
});
|
};
|
||||||
|
|
||||||
expect(selectApp()(mockedState)).toEqual(appState);
|
expect(selectApp()(mockedState)).toEqual(appState);
|
||||||
});
|
});
|
||||||
@ -25,40 +22,14 @@ describe('<App /> selectors', () => {
|
|||||||
describe('makeSelectApp', () => {
|
describe('makeSelectApp', () => {
|
||||||
it('should select the appState (.toJS())', () => {
|
it('should select the appState (.toJS())', () => {
|
||||||
const appState = fromJS({});
|
const appState = fromJS({});
|
||||||
const mockedState = fromJS({
|
const mockedState = {
|
||||||
app: appState,
|
app: appState,
|
||||||
});
|
};
|
||||||
|
|
||||||
expect(makeSelectApp()(mockedState)).toEqual(appState.toJS());
|
expect(makeSelectApp()(mockedState)).toEqual(appState.toJS());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('selectHasUserPlugin', () => {
|
|
||||||
it('should select the hasUserPlugin', () => {
|
|
||||||
const appState = fromJS({
|
|
||||||
hasUserPlugin: true,
|
|
||||||
});
|
|
||||||
const mockedState = fromJS({
|
|
||||||
app: appState,
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(selectHasUserPlugin()(mockedState)).toEqual(true);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('selectPlugins', () => {
|
|
||||||
it('should select the plugins', () => {
|
|
||||||
const plugins = fromJS({ email: { isReady: true } });
|
|
||||||
const mockedState = fromJS({
|
|
||||||
app: {
|
|
||||||
plugins,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(selectPlugins()(mockedState)).toEqual(plugins);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('makeSelectBlockApp', () => {
|
describe('makeSelectBlockApp', () => {
|
||||||
it('should select the blockApp', () => {
|
it('should select the blockApp', () => {
|
||||||
const mockedState = fromJS({
|
const mockedState = fromJS({
|
||||||
@ -74,11 +45,11 @@ describe('<App /> selectors', () => {
|
|||||||
describe('makeSelectOverlayBlockerProps', () => {
|
describe('makeSelectOverlayBlockerProps', () => {
|
||||||
it('should select the overlayBlockerData', () => {
|
it('should select the overlayBlockerData', () => {
|
||||||
const overlayBlockerData = fromJS({ title: 'title' });
|
const overlayBlockerData = fromJS({ title: 'title' });
|
||||||
const mockedState = fromJS({
|
const mockedState = {
|
||||||
app: {
|
app: {
|
||||||
overlayBlockerData,
|
overlayBlockerData,
|
||||||
},
|
},
|
||||||
});
|
};
|
||||||
|
|
||||||
expect(makeSelectOverlayBlockerProps()(mockedState)).toEqual(overlayBlockerData);
|
expect(makeSelectOverlayBlockerProps()(mockedState)).toEqual(overlayBlockerData);
|
||||||
});
|
});
|
||||||
@ -86,25 +57,13 @@ describe('<App /> selectors', () => {
|
|||||||
|
|
||||||
describe('makeSelectShowGlobalAppBlocker', () => {
|
describe('makeSelectShowGlobalAppBlocker', () => {
|
||||||
it('should select the showGlobalAppBlocker', () => {
|
it('should select the showGlobalAppBlocker', () => {
|
||||||
const mockedState = fromJS({
|
const mockedState = {
|
||||||
app: {
|
app: {
|
||||||
showGlobalAppBlocker: true,
|
showGlobalAppBlocker: true,
|
||||||
},
|
},
|
||||||
});
|
};
|
||||||
|
|
||||||
expect(makeSelectShowGlobalAppBlocker()(mockedState)).toEqual(true);
|
expect(makeSelectShowGlobalAppBlocker()(mockedState)).toEqual(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('makeSelectUuid', () => {
|
|
||||||
it('should select the showGlobalAppBlocker', () => {
|
|
||||||
const mockedState = fromJS({
|
|
||||||
app: {
|
|
||||||
uuid: 'getstarted',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(makeSelectUuid()(mockedState)).toEqual('getstarted');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|||||||
@ -8,9 +8,9 @@ describe('<LocaleToggle /> selectors', () => {
|
|||||||
const state = fromJS({
|
const state = fromJS({
|
||||||
className: null,
|
className: null,
|
||||||
});
|
});
|
||||||
const mockedState = fromJS({
|
const mockedState = {
|
||||||
localeToggle: state,
|
localeToggle: state,
|
||||||
});
|
};
|
||||||
|
|
||||||
expect(selectLocaleToggle()(mockedState)).toEqual(state);
|
expect(selectLocaleToggle()(mockedState)).toEqual(state);
|
||||||
});
|
});
|
||||||
@ -21,9 +21,9 @@ describe('<LocaleToggle /> selectors', () => {
|
|||||||
const state = fromJS({
|
const state = fromJS({
|
||||||
className: null,
|
className: null,
|
||||||
});
|
});
|
||||||
const mockedState = fromJS({
|
const mockedState = {
|
||||||
localeToggle: state,
|
localeToggle: state,
|
||||||
});
|
};
|
||||||
|
|
||||||
expect(makeSelectLocaleToggle()(mockedState)).toEqual(state.toJS());
|
expect(makeSelectLocaleToggle()(mockedState)).toEqual(state.toJS());
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user