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

36 lines
1.3 KiB
JavaScript
Raw Normal View History

2020-06-09 18:08:07 -07:00
import reducer from '../accounts_counters';
import { Map as ImmutableMap } from 'immutable';
2020-07-14 05:43:56 -07:00
import { ACCOUNT_FOLLOW_SUCCESS, ACCOUNT_UNFOLLOW_SUCCESS } from 'soapbox/actions/accounts';
import relationship from 'soapbox/__fixtures__/relationship.json';
import accounts_counter_initial from 'soapbox/__fixtures__/accounts_counter_initial.json';
import accounts_counter_unfollow from 'soapbox/__fixtures__/accounts_counter_unfollow.json';
import accounts_counter_follow from 'soapbox/__fixtures__/accounts_counter_follow.json';
2020-06-09 18:08:07 -07:00
describe('accounts_counters reducer', () => {
it('should return the initial state', () => {
expect(reducer(undefined, {})).toEqual(ImmutableMap());
});
2020-07-14 05:43:56 -07:00
it('should handle ACCOUNT_FOLLOW_SUCCESS', () => {
// const state = accounts_counter_initial;
const action = {
type: ACCOUNT_FOLLOW_SUCCESS,
relationship: relationship,
alreadyFollowing: false,
};
expect(reducer(accounts_counter_initial, action)).toEqual( accounts_counter_follow );
});
it('should handle ACCOUNT_UNFOLLOW_SUCCESS', () => {
// const state = accounts_counter_initial;
const action = {
type: ACCOUNT_UNFOLLOW_SUCCESS,
relationship: relationship,
alreadyFollowing: true,
};
expect(reducer(accounts_counter_initial, action)).toEqual( accounts_counter_unfollow );
});
2020-06-09 18:08:07 -07:00
});