2022-03-08 21:59:59 -08:00
|
|
|
import { Map as ImmutableMap, Record } from 'immutable';
|
|
|
|
|
|
|
|
import { ACCOUNT_IMPORT } from 'soapbox/actions/importer';
|
2022-01-10 14:25:06 -08:00
|
|
|
|
2022-01-10 14:01:24 -08:00
|
|
|
import reducer from '../accounts';
|
2020-07-14 15:11:05 -07:00
|
|
|
// import * as actions from 'soapbox/actions/importer';
|
|
|
|
// import { take } from 'lodash';
|
|
|
|
// import accounts from 'soapbox/__fixtures__/accounts.json';
|
2020-06-09 18:08:07 -07:00
|
|
|
|
|
|
|
describe('accounts reducer', () => {
|
|
|
|
it('should return the initial state', () => {
|
|
|
|
expect(reducer(undefined, {})).toEqual(ImmutableMap());
|
|
|
|
});
|
2020-07-05 17:38:32 -07:00
|
|
|
|
2022-03-08 21:59:59 -08:00
|
|
|
describe('ACCOUNT_IMPORT', () => {
|
|
|
|
it('parses the account as a Record', () => {
|
|
|
|
const account = require('soapbox/__fixtures__/pleroma-account.json');
|
|
|
|
const action = { type: ACCOUNT_IMPORT, account };
|
|
|
|
const result = reducer(undefined, action).get('9v5bmRalQvjOy0ECcC');
|
|
|
|
|
|
|
|
expect(Record.isRecord(result)).toBe(true);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2020-07-14 15:11:05 -07:00
|
|
|
// fails to add normalized accounts to state
|
|
|
|
// it('should handle ACCOUNT_IMPORT', () => {
|
|
|
|
// const state = ImmutableMap({ });
|
|
|
|
// const account = take(accounts, 1);
|
|
|
|
// const action = {
|
|
|
|
// type: actions.ACCOUNT_IMPORT,
|
|
|
|
// account: account,
|
|
|
|
// };
|
|
|
|
// debugger;
|
|
|
|
// expect(reducer(state, action).toJS()).toMatchObject({
|
|
|
|
// });
|
|
|
|
// });
|
2020-07-05 17:38:32 -07:00
|
|
|
|
2020-07-14 15:11:05 -07:00
|
|
|
// fails to add normalized accounts to state
|
|
|
|
// it('should handle ACCOUNTS_IMPORT', () => {
|
|
|
|
// const state = ImmutableMap({ });
|
|
|
|
// const accounts = take(accounts, 2);
|
|
|
|
// const action = {
|
|
|
|
// type: actions.ACCOUNTS_IMPORT,
|
|
|
|
// accounts: accounts,
|
|
|
|
// };
|
|
|
|
// expect(reducer(state, action).toJS()).toMatchObject({
|
|
|
|
// });
|
|
|
|
// });
|
|
|
|
//
|
|
|
|
// it('should handle ACCOUNT_FETCH_FAIL_FOR_USERNAME_LOOKUP', () => {
|
|
|
|
// const state = ImmutableMap({ username: 'curtis' });
|
|
|
|
// const action = {
|
|
|
|
// type: actions.ACCOUNT_FETCH_FAIL_FOR_USERNAME_LOOKUP,
|
|
|
|
// username: 'curtis',
|
|
|
|
// };
|
|
|
|
// expect(reducer(state, action).toJS()).toMatchObject({
|
|
|
|
// username: 'curtis',
|
|
|
|
// });
|
|
|
|
// });
|
2020-07-05 17:38:32 -07:00
|
|
|
|
2020-06-09 18:08:07 -07:00
|
|
|
});
|