kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Merge branch 'test-state' into 'main'
Fix initial Redux state in tests See merge request soapbox-pub/soapbox!3199environments/review-update-vid-g70vyz/deployments/5013
commit
25eff679ca
|
@ -1,5 +1,4 @@
|
||||||
import MockAdapter from 'axios-mock-adapter';
|
import MockAdapter from 'axios-mock-adapter';
|
||||||
import { Map as ImmutableMap } from 'immutable';
|
|
||||||
|
|
||||||
import { staticClient } from 'soapbox/api';
|
import { staticClient } from 'soapbox/api';
|
||||||
import { mockStore } from 'soapbox/jest/test-helpers';
|
import { mockStore } from 'soapbox/jest/test-helpers';
|
||||||
|
@ -23,7 +22,7 @@ describe('fetchAboutPage()', () => {
|
||||||
{ type: FETCH_ABOUT_PAGE_REQUEST, slug: 'index' },
|
{ type: FETCH_ABOUT_PAGE_REQUEST, slug: 'index' },
|
||||||
{ type: FETCH_ABOUT_PAGE_SUCCESS, slug: 'index', html: '<h1>Hello world</h1>' },
|
{ type: FETCH_ABOUT_PAGE_SUCCESS, slug: 'index', html: '<h1>Hello world</h1>' },
|
||||||
];
|
];
|
||||||
const store = mockStore(ImmutableMap());
|
const store = mockStore({});
|
||||||
|
|
||||||
return store.dispatch(fetchAboutPage()).then(() => {
|
return store.dispatch(fetchAboutPage()).then(() => {
|
||||||
expect(store.getActions()).toEqual(expectedActions);
|
expect(store.getActions()).toEqual(expectedActions);
|
||||||
|
@ -35,7 +34,7 @@ describe('fetchAboutPage()', () => {
|
||||||
{ type: FETCH_ABOUT_PAGE_REQUEST, slug: 'asdf' },
|
{ type: FETCH_ABOUT_PAGE_REQUEST, slug: 'asdf' },
|
||||||
{ type: FETCH_ABOUT_PAGE_FAIL, slug: 'asdf', error: new Error('Request failed with status code 404') },
|
{ type: FETCH_ABOUT_PAGE_FAIL, slug: 'asdf', error: new Error('Request failed with status code 404') },
|
||||||
];
|
];
|
||||||
const store = mockStore(ImmutableMap());
|
const store = mockStore({});
|
||||||
|
|
||||||
return store.dispatch(fetchAboutPage('asdf')).catch(() => {
|
return store.dispatch(fetchAboutPage('asdf')).catch(() => {
|
||||||
expect(store.getActions()).toEqual(expectedActions);
|
expect(store.getActions()).toEqual(expectedActions);
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
import { Map as ImmutableMap } from 'immutable';
|
|
||||||
|
|
||||||
import { __stub } from 'soapbox/api';
|
import { __stub } from 'soapbox/api';
|
||||||
import { mockStore } from 'soapbox/jest/test-helpers';
|
import { mockStore } from 'soapbox/jest/test-helpers';
|
||||||
|
|
||||||
|
@ -19,7 +17,7 @@ describe('preloadMastodon()', () => {
|
||||||
.reply(200, {});
|
.reply(200, {});
|
||||||
});
|
});
|
||||||
|
|
||||||
const store = mockStore(ImmutableMap());
|
const store = mockStore({});
|
||||||
store.dispatch(preloadMastodon(data));
|
store.dispatch(preloadMastodon(data));
|
||||||
const actions = store.getActions();
|
const actions = store.getActions();
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue