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

30 lines
830 B
JavaScript
Raw Normal View History

2022-01-10 14:01:24 -08:00
import { Map as ImmutableMap, fromJS } from 'immutable';
2020-06-09 18:08:07 -07:00
import reducer from '../patron';
2020-07-04 19:25:43 -07:00
import { PATRON_ACCOUNT_FETCH_SUCCESS } from '../../actions/patron';
2020-06-09 18:08:07 -07:00
describe('patron reducer', () => {
it('should return the initial state', () => {
expect(reducer(undefined, {})).toEqual(ImmutableMap());
});
2020-07-04 19:25:43 -07:00
describe('PATRON_ACCOUNT_FETCH_SUCCESS', () => {
it('should add the account', () => {
const action = {
type: PATRON_ACCOUNT_FETCH_SUCCESS,
account: {
url: 'https://gleasonator.com/users/alex',
is_patron: true,
},
};
const state = ImmutableMap();
expect(reducer(state, action)).toEqual(fromJS({
accounts: {
'https://gleasonator.com/users/alex': {
is_patron: true,
},
},
}));
});
});
2020-06-09 18:08:07 -07:00
});