Test account.moved

This commit is contained in:
Alex Gleason 2022-03-12 14:52:03 -06:00
parent 66e51fa5ef
commit 2089cb124d
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
2 changed files with 56 additions and 42 deletions

View file

@ -0,0 +1,46 @@
{
"id": "106801667066418367",
"username": "benis911",
"acct": "benis911",
"display_name": "",
"locked": false,
"bot": false,
"discoverable": null,
"group": false,
"created_at": "2021-08-22T00:00:00.000Z",
"note": "",
"url": "https://mastodon.social/@benis911",
"avatar": "https://mastodon.social/avatars/original/missing.png",
"avatar_static": "https://mastodon.social/avatars/original/missing.png",
"header": "https://mastodon.social/headers/original/missing.png",
"header_static": "https://mastodon.social/headers/original/missing.png",
"followers_count": 0,
"following_count": 0,
"statuses_count": 5,
"last_status_at": "2022-02-23",
"moved": {
"id": "107945464165013501",
"username": "alex",
"acct": "alex@fedibird.com",
"display_name": "",
"locked": false,
"bot": false,
"discoverable": false,
"group": false,
"created_at": "2020-01-27T00:00:00.000Z",
"note": "<p></p>",
"url": "https://fedibird.com/@alex",
"avatar": "https://mastodon.social/avatars/original/missing.png",
"avatar_static": "https://mastodon.social/avatars/original/missing.png",
"header": "https://mastodon.social/headers/original/missing.png",
"header_static": "https://mastodon.social/headers/original/missing.png",
"followers_count": 1,
"following_count": 1,
"statuses_count": 5,
"last_status_at": null,
"emojis": [],
"fields": []
},
"emojis": [],
"fields": []
}

View file

@ -1,11 +1,8 @@
import { Map as ImmutableMap, Record } from 'immutable';
import { Map as ImmutableMap, Record as ImmutableRecord } from 'immutable';
import { ACCOUNT_IMPORT } from 'soapbox/actions/importer';
import reducer from '../accounts';
// import * as actions from 'soapbox/actions/importer';
// import { take } from 'lodash';
// import accounts from 'soapbox/__fixtures__/accounts.json';
describe('accounts reducer', () => {
it('should return the initial state', () => {
@ -18,44 +15,15 @@ describe('accounts reducer', () => {
const action = { type: ACCOUNT_IMPORT, account };
const result = reducer(undefined, action).get('9v5bmRalQvjOy0ECcC');
expect(Record.isRecord(result)).toBe(true);
expect(ImmutableRecord.isRecord(result)).toBe(true);
});
it('minifies a moved account', () => {
const account = require('soapbox/__fixtures__/account-moved.json');
const action = { type: ACCOUNT_IMPORT, account };
const result = reducer(undefined, action).get('106801667066418367');
expect(result.moved).toBe('107945464165013501');
});
});
// 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({
// });
// });
// 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',
// });
// });
});