dg-npm-templates
Version:
Npx generator for react app dependency creation by digite
37 lines (32 loc) • 1 kB
JavaScript
import appReducer, {
initAppComp,
showLoading,
hideLoading,
} from 'js/app/slice/AppSlice';
describe('appData reducer', () => {
const initialState = {};
it('should handle initial state', () => {
expect(appReducer(undefined, { type: 'unknown' })).toEqual({});
});
it('should set initial state', () => {
const actual = appReducer(initialState, initAppComp());
expect(actual.appData).toEqual({
showMask: false,
initialConfig: {
"welcomeMsg": "Welcome to React micro frontend",
}
});
});
it('should show Loading', () => {
const actual = appReducer(initialState, showLoading());
expect(actual.appData).toEqual({
showMask: true
});
});
it('should hide Loading', () => {
const actual = appReducer(initialState, hideLoading());
expect(actual.appData).toEqual({
showMask: false
});
});
});