2020-06-09 18:08:07 -07:00
|
|
|
import reducer from '../mutes';
|
|
|
|
import { Map as ImmutableMap } from 'immutable';
|
2020-07-09 16:44:23 -07:00
|
|
|
import {
|
|
|
|
MUTES_INIT_MODAL,
|
|
|
|
MUTES_TOGGLE_HIDE_NOTIFICATIONS,
|
|
|
|
} from 'soapbox/actions/mutes';
|
2020-06-09 18:08:07 -07:00
|
|
|
|
|
|
|
describe('mutes reducer', () => {
|
|
|
|
it('should return the initial state', () => {
|
|
|
|
expect(reducer(undefined, {})).toEqual(ImmutableMap({
|
|
|
|
new: ImmutableMap({
|
|
|
|
isSubmitting: false,
|
|
|
|
account: null,
|
|
|
|
notifications: true,
|
|
|
|
}),
|
|
|
|
}));
|
|
|
|
});
|
2020-07-09 16:44:23 -07:00
|
|
|
|
|
|
|
it('should handle MUTES_INIT_MODAL', () => {
|
|
|
|
const state = ImmutableMap({
|
|
|
|
new: ImmutableMap({
|
|
|
|
isSubmitting: false,
|
|
|
|
account: null,
|
|
|
|
notifications: true,
|
|
|
|
}),
|
|
|
|
});
|
|
|
|
const action = {
|
|
|
|
type: MUTES_INIT_MODAL,
|
|
|
|
account: 'account1',
|
2020-07-09 17:37:04 -07:00
|
|
|
};
|
2020-07-09 16:44:23 -07:00
|
|
|
expect(reducer(state, action)).toEqual(ImmutableMap({
|
|
|
|
new: ImmutableMap({
|
|
|
|
isSubmitting: false,
|
|
|
|
account: 'account1',
|
|
|
|
notifications: true,
|
|
|
|
}),
|
|
|
|
}));
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should handle MUTES_TOGGLE_HIDE_NOTIFICATIONS', () => {
|
|
|
|
const state = ImmutableMap({
|
|
|
|
new: ImmutableMap({
|
|
|
|
notifications: true,
|
|
|
|
}),
|
|
|
|
});
|
|
|
|
const action = {
|
|
|
|
type: MUTES_TOGGLE_HIDE_NOTIFICATIONS,
|
2020-07-09 17:37:04 -07:00
|
|
|
};
|
2020-07-09 16:44:23 -07:00
|
|
|
expect(reducer(state, action)).toEqual(ImmutableMap({
|
|
|
|
new: ImmutableMap({
|
|
|
|
notifications: false,
|
|
|
|
}),
|
|
|
|
}));
|
|
|
|
});
|
|
|
|
|
2020-06-09 18:08:07 -07:00
|
|
|
});
|