bigbuffet-rw/app/soapbox/reducers/__tests__/modal-test.js
marcin mikołajczak b0477ac1e1 fix broken modals
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2022-01-07 00:50:32 +01:00

45 lines
996 B
JavaScript

import reducer from '../modal';
import { MODAL_OPEN, MODAL_CLOSE } from 'soapbox/actions/modal';
describe('modal reducer', () => {
it('should return the initial state', () => {
expect(reducer(undefined, {})).toEqual({
modalType: null,
modalProps: {},
noPop: false,
});
});
it('should handle MODAL_OPEN', () => {
const state = {
modalType: null,
modalProps: {},
noPop: false,
};
const action = {
type: MODAL_OPEN,
modalType: 'type1',
modalProps: { props1: '1' },
};
expect(reducer(state, action)).toMatchObject({
modalType: 'type1',
modalProps: { props1: '1' },
});
});
it('should handle MODAL_CLOSE', () => {
const state = {
modalType: 'type1',
modalProps: { props1: '1' },
};
const action = {
type: MODAL_CLOSE,
};
expect(reducer(state, action)).toMatchObject({
modalType: null,
modalProps: {},
noPop: false,
});
});
});