bigbuffet-rw/app/soapbox/reducers/__tests__/modal-test.js

45 lines
964 B
JavaScript
Raw Normal View History

2020-06-09 18:08:07 -07:00
import reducer from '../modal';
2020-07-09 16:44:23 -07:00
import { MODAL_OPEN, MODAL_CLOSE } from 'soapbox/actions/modal';
2020-06-09 18:08:07 -07:00
describe('modal reducer', () => {
it('should return the initial state', () => {
expect(reducer(undefined, {})).toEqual({
modalType: null,
modalProps: {},
});
});
2020-07-09 16:44:23 -07:00
it('should handle MODAL_OPEN', () => {
const state = {
modalType: null,
modalProps: {},
2020-07-09 17:37:04 -07:00
};
2020-07-09 16:44:23 -07:00
const action = {
type: MODAL_OPEN,
modalType: 'type1',
modalProps: { props1: '1' },
2020-07-09 17:37:04 -07:00
};
2020-07-09 16:44:23 -07:00
debugger;
expect(reducer(state, action)).toMatchObject({
modalType: 'type1',
modalProps: { props1: '1' },
});
});
it('should handle MODAL_CLOSE', () => {
const state = {
modalType: 'type1',
modalProps: { props1: '1' },
2020-07-09 17:37:04 -07:00
};
2020-07-09 16:44:23 -07:00
const action = {
type: MODAL_CLOSE,
2020-07-09 17:37:04 -07:00
};
2020-07-09 16:44:23 -07:00
debugger;
expect(reducer(state, action)).toMatchObject({
modalType: null,
modalProps: {},
});
});
2020-06-09 18:08:07 -07:00
});