bigbuffet-rw/app/soapbox/reducers/__tests__/mutes.test.ts
marcin mikołajczak 7b5114a1b8 prefer TypeScript for tests
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2022-06-12 23:07:06 +02:00

62 lines
1.4 KiB
TypeScript

import { Record as ImmutableRecord } from 'immutable';
import {
MUTES_INIT_MODAL,
MUTES_TOGGLE_HIDE_NOTIFICATIONS,
} from 'soapbox/actions/mutes';
import reducer from '../mutes';
describe('mutes reducer', () => {
it('should return the initial state', () => {
expect(reducer(undefined, {}).toJS()).toEqual({
new: {
isSubmitting: false,
accountId: null,
notifications: true,
},
});
});
it('should handle MUTES_INIT_MODAL', () => {
const state = ImmutableRecord({
new: ImmutableRecord({
isSubmitting: false,
accountId: null,
notifications: true,
})(),
})();
const action = {
type: MUTES_INIT_MODAL,
account: { id: 'account1' },
};
expect(reducer(state, action).toJS()).toEqual({
new: {
isSubmitting: false,
accountId: 'account1',
notifications: true,
},
});
});
it('should handle MUTES_TOGGLE_HIDE_NOTIFICATIONS', () => {
const state = ImmutableRecord({
new: ImmutableRecord({
isSubmitting: false,
accountId: null,
notifications: true,
})(),
})();
const action = {
type: MUTES_TOGGLE_HIDE_NOTIFICATIONS,
};
expect(reducer(state, action).toJS()).toEqual({
new: {
isSubmitting: false,
accountId: null,
notifications: false,
},
});
});
});