Preload: fix Mastodon accounts import
This commit is contained in:
parent
43a6e26a36
commit
1b6d2568b3
2 changed files with 24 additions and 1 deletions
23
app/soapbox/actions/__tests__/preload-test.js
Normal file
23
app/soapbox/actions/__tests__/preload-test.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
import {
|
||||
MASTODON_PRELOAD_IMPORT,
|
||||
preloadMastodon,
|
||||
} from '../preload';
|
||||
import { ACCOUNTS_IMPORT } from '../importer';
|
||||
import { Map as ImmutableMap } from 'immutable';
|
||||
import { mockStore } from 'soapbox/test_helpers';
|
||||
|
||||
describe('preloadMastodon()', () => {
|
||||
it('creates the expected actions', () => {
|
||||
const data = require('soapbox/__fixtures__/mastodon_initial_state.json');
|
||||
|
||||
const store = mockStore(ImmutableMap());
|
||||
store.dispatch(preloadMastodon(data));
|
||||
const actions = store.getActions();
|
||||
|
||||
expect(actions[0].type).toEqual(ACCOUNTS_IMPORT);
|
||||
expect(actions[0].accounts[0].username).toEqual('Gargron');
|
||||
expect(actions[0].accounts[1].username).toEqual('benis911');
|
||||
|
||||
expect(actions[1]).toEqual({ type: MASTODON_PRELOAD_IMPORT, data });
|
||||
});
|
||||
});
|
|
@ -52,7 +52,7 @@ export function preloadPleroma(data) {
|
|||
|
||||
export function preloadMastodon(data) {
|
||||
return (dispatch, getState) => {
|
||||
importFetchedAccounts(Object.values(data.accounts));
|
||||
dispatch(importFetchedAccounts(Object.values(data.accounts)));
|
||||
dispatch({ type: MASTODON_PRELOAD_IMPORT, data });
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue