pleroma/packages/pl-fe/src/reducers/onboarding.test.ts

28 lines
881 B
TypeScript
Raw Normal View History

import { ONBOARDING_START, ONBOARDING_END } from 'pl-fe/actions/onboarding';
2022-05-02 13:55:52 -07:00
import reducer from './onboarding';
2022-05-02 13:55:52 -07:00
describe('onboarding reducer', () => {
it('should return the initial state', () => {
2022-07-06 09:53:55 -07:00
expect(reducer(undefined, {} as any)).toEqual({
2022-05-02 13:55:52 -07:00
needsOnboarding: false,
});
});
describe('ONBOARDING_START', () => {
it('sets "needsOnboarding" to "true"', () => {
const initialState = { needsOnboarding: false };
2022-07-06 09:53:55 -07:00
const action = { type: ONBOARDING_START } as any;
2022-05-02 13:55:52 -07:00
expect(reducer(initialState, action).needsOnboarding).toEqual(true);
});
});
describe('ONBOARDING_END', () => {
it('sets "needsOnboarding" to "false"', () => {
const initialState = { needsOnboarding: true };
2022-07-06 09:53:55 -07:00
const action = { type: ONBOARDING_END } as any;
2022-05-02 13:55:52 -07:00
expect(reducer(initialState, action).needsOnboarding).toEqual(false);
});
});
});