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

40 lines
1.1 KiB
JavaScript
Raw Normal View History

2021-10-02 13:18:27 -07:00
import { Map as ImmutableMap, List as ImmutableList, fromJS } from 'immutable';
2021-10-02 13:18:27 -07:00
import { SUGGESTIONS_DISMISS } from 'soapbox/actions/suggestions';
2022-01-10 14:01:24 -08:00
import reducer from '../suggestions';
2020-06-09 18:08:07 -07:00
describe('suggestions reducer', () => {
it('should return the initial state', () => {
expect(reducer(undefined, {})).toEqual(ImmutableMap({
items: ImmutableList(),
isLoading: false,
}));
});
2021-10-02 13:18:27 -07:00
describe('SUGGESTIONS_DISMISS', () => {
it('should remove the account', () => {
const action = { type: SUGGESTIONS_DISMISS, id: '123' };
const state = fromJS({
items: [
{ account: '123', source: 'past_interactions' },
{ account: '456', source: 'past_interactions' },
{ account: '789', source: 'past_interactions' },
],
isLoading: false,
});
const expected = fromJS({
items: [
{ account: '456', source: 'past_interactions' },
{ account: '789', source: 'past_interactions' },
],
isLoading: false,
});
expect(reducer(state, action)).toEqual(expected);
});
});
2020-06-09 18:08:07 -07:00
});