mirror of
https://github.com/strapi/strapi.git
synced 2025-11-01 02:16:03 +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
|
||||
*/
|
||||
|
||||
const selectPlugins = () => createSelector(selectApp(), appState => appState.get('plugins'));
|
||||
|
||||
const makeSelectApp = () => createSelector(selectApp(), appState => appState.toJS());
|
||||
|
||||
const selectHasUserPlugin = () =>
|
||||
createSelector(selectApp(), appState => appState.get('hasUserPlugin'));
|
||||
|
||||
const makeSelectShowGlobalAppBlocker = () =>
|
||||
createSelector(selectApp(), appState => appState.get('showGlobalAppBlocker'));
|
||||
|
||||
@ -24,15 +19,10 @@ const makeSelectBlockApp = () => createSelector(selectApp(), appState => appStat
|
||||
const makeSelectOverlayBlockerProps = () =>
|
||||
createSelector(selectApp(), appState => appState.get('overlayBlockerData'));
|
||||
|
||||
const makeSelectUuid = () => createSelector(selectApp(), appState => appState.get('uuid'));
|
||||
|
||||
export default makeSelectApp;
|
||||
export {
|
||||
selectApp,
|
||||
selectHasUserPlugin,
|
||||
selectPlugins,
|
||||
makeSelectBlockApp,
|
||||
makeSelectOverlayBlockerProps,
|
||||
makeSelectShowGlobalAppBlocker,
|
||||
makeSelectUuid,
|
||||
};
|
||||
|
||||
@ -2,21 +2,18 @@ import { fromJS } from 'immutable';
|
||||
|
||||
import makeSelectApp, {
|
||||
selectApp,
|
||||
selectHasUserPlugin,
|
||||
selectPlugins,
|
||||
makeSelectBlockApp,
|
||||
makeSelectOverlayBlockerProps,
|
||||
makeSelectShowGlobalAppBlocker,
|
||||
makeSelectUuid,
|
||||
} from '../selectors';
|
||||
|
||||
describe('<App /> selectors', () => {
|
||||
describe('selectApp', () => {
|
||||
it('should select the global state', () => {
|
||||
const appState = fromJS({});
|
||||
const mockedState = fromJS({
|
||||
const mockedState = {
|
||||
app: appState,
|
||||
});
|
||||
};
|
||||
|
||||
expect(selectApp()(mockedState)).toEqual(appState);
|
||||
});
|
||||
@ -25,40 +22,14 @@ describe('<App /> selectors', () => {
|
||||
describe('makeSelectApp', () => {
|
||||
it('should select the appState (.toJS())', () => {
|
||||
const appState = fromJS({});
|
||||
const mockedState = fromJS({
|
||||
const mockedState = {
|
||||
app: appState,
|
||||
});
|
||||
};
|
||||
|
||||
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', () => {
|
||||
it('should select the blockApp', () => {
|
||||
const mockedState = fromJS({
|
||||
@ -74,11 +45,11 @@ describe('<App /> selectors', () => {
|
||||
describe('makeSelectOverlayBlockerProps', () => {
|
||||
it('should select the overlayBlockerData', () => {
|
||||
const overlayBlockerData = fromJS({ title: 'title' });
|
||||
const mockedState = fromJS({
|
||||
const mockedState = {
|
||||
app: {
|
||||
overlayBlockerData,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
expect(makeSelectOverlayBlockerProps()(mockedState)).toEqual(overlayBlockerData);
|
||||
});
|
||||
@ -86,25 +57,13 @@ describe('<App /> selectors', () => {
|
||||
|
||||
describe('makeSelectShowGlobalAppBlocker', () => {
|
||||
it('should select the showGlobalAppBlocker', () => {
|
||||
const mockedState = fromJS({
|
||||
const mockedState = {
|
||||
app: {
|
||||
showGlobalAppBlocker: 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({
|
||||
className: null,
|
||||
});
|
||||
const mockedState = fromJS({
|
||||
const mockedState = {
|
||||
localeToggle: state,
|
||||
});
|
||||
};
|
||||
|
||||
expect(selectLocaleToggle()(mockedState)).toEqual(state);
|
||||
});
|
||||
@ -21,9 +21,9 @@ describe('<LocaleToggle /> selectors', () => {
|
||||
const state = fromJS({
|
||||
className: null,
|
||||
});
|
||||
const mockedState = fromJS({
|
||||
const mockedState = {
|
||||
localeToggle: state,
|
||||
});
|
||||
};
|
||||
|
||||
expect(makeSelectLocaleToggle()(mockedState)).toEqual(state.toJS());
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user