2022-01-10 14:01:24 -08:00
|
|
|
import { Map as ImmutableMap, fromJS } from 'immutable';
|
2022-01-10 14:25:06 -08:00
|
|
|
|
2022-01-10 14:01:24 -08:00
|
|
|
import lain from 'soapbox/__fixtures__/lain.json';
|
2022-01-10 14:25:06 -08:00
|
|
|
|
2020-07-04 18:48:31 -07:00
|
|
|
import {
|
|
|
|
ACCOUNT_IMPORT,
|
|
|
|
} from '../../actions/importer';
|
2022-01-10 14:17:52 -08:00
|
|
|
import reducer from '../relationships';
|
2020-06-09 18:08:07 -07:00
|
|
|
|
|
|
|
describe('relationships reducer', () => {
|
|
|
|
it('should return the initial state', () => {
|
|
|
|
expect(reducer(undefined, {})).toEqual(ImmutableMap());
|
|
|
|
});
|
2020-07-04 18:48:31 -07:00
|
|
|
|
|
|
|
describe('ACCOUNT_IMPORT', () => {
|
|
|
|
it('should import the relationship', () => {
|
|
|
|
const action = {
|
|
|
|
type: ACCOUNT_IMPORT,
|
|
|
|
account: lain,
|
|
|
|
};
|
|
|
|
const state = ImmutableMap();
|
|
|
|
expect(reducer(state, action)).toEqual(fromJS({
|
|
|
|
'9v5bqYwY2jfmvPNhTM': {
|
|
|
|
blocked_by: false,
|
|
|
|
blocking: false,
|
|
|
|
domain_blocking: false,
|
|
|
|
endorsed: false,
|
|
|
|
followed_by: true,
|
|
|
|
following: true,
|
|
|
|
id: '9v5bqYwY2jfmvPNhTM',
|
|
|
|
muting: false,
|
|
|
|
muting_notifications: false,
|
|
|
|
requested: false,
|
|
|
|
showing_reblogs: true,
|
|
|
|
subscribing: false,
|
|
|
|
},
|
|
|
|
}));
|
|
|
|
});
|
|
|
|
});
|
2020-06-09 18:08:07 -07:00
|
|
|
});
|