bigbuffet-rw/app/soapbox/reducers/__tests__/mutes.test.ts
marcin mikołajczak ac83c9c18c Support mutes duration
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2022-07-31 11:57:31 +02:00

67 lines
1.5 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, {} as any).toJS()).toEqual({
new: {
isSubmitting: false,
accountId: null,
notifications: true,
duration: 0,
},
});
});
it('should handle MUTES_INIT_MODAL', () => {
const state = ImmutableRecord({
new: ImmutableRecord({
isSubmitting: false,
accountId: null,
notifications: true,
duration: 0,
})(),
})();
const action = {
type: MUTES_INIT_MODAL,
account: { id: 'account1' },
};
expect(reducer(state, action).toJS()).toEqual({
new: {
isSubmitting: false,
accountId: 'account1',
notifications: true,
duration: 0,
},
});
});
it('should handle MUTES_TOGGLE_HIDE_NOTIFICATIONS', () => {
const state = ImmutableRecord({
new: ImmutableRecord({
isSubmitting: false,
accountId: null,
notifications: true,
duration: 0,
})(),
})();
const action = {
type: MUTES_TOGGLE_HIDE_NOTIFICATIONS,
};
expect(reducer(state, action).toJS()).toEqual({
new: {
isSubmitting: false,
accountId: null,
notifications: false,
duration: 0,
},
});
});
});