bigbuffet-rw/app/soapbox/reducers/__tests__/modal-test.js
2020-07-09 19:37:04 -05:00

44 lines
964 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: {},
});
});
it('should handle MODAL_OPEN', () => {
const state = {
modalType: null,
modalProps: {},
};
const action = {
type: MODAL_OPEN,
modalType: 'type1',
modalProps: { props1: '1' },
};
debugger;
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,
};
debugger;
expect(reducer(state, action)).toMatchObject({
modalType: null,
modalProps: {},
});
});
});