Merge branch 'test-state' into 'main'

Fix initial Redux state in tests

See merge request soapbox-pub/soapbox!3199
environments/review-update-vid-g70vyz/deployments/5013
Alex Gleason 2024-10-28 18:42:43 +00:00
commit 25eff679ca
2 zmienionych plików z 3 dodań i 6 usunięć

Wyświetl plik

@ -1,5 +1,4 @@
import MockAdapter from 'axios-mock-adapter';
import { Map as ImmutableMap } from 'immutable';
import { staticClient } from 'soapbox/api';
import { mockStore } from 'soapbox/jest/test-helpers';
@ -23,7 +22,7 @@ describe('fetchAboutPage()', () => {
{ type: FETCH_ABOUT_PAGE_REQUEST, slug: 'index' },
{ type: FETCH_ABOUT_PAGE_SUCCESS, slug: 'index', html: '<h1>Hello world</h1>' },
];
const store = mockStore(ImmutableMap());
const store = mockStore({});
return store.dispatch(fetchAboutPage()).then(() => {
expect(store.getActions()).toEqual(expectedActions);
@ -35,7 +34,7 @@ describe('fetchAboutPage()', () => {
{ type: FETCH_ABOUT_PAGE_REQUEST, slug: 'asdf' },
{ 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(() => {
expect(store.getActions()).toEqual(expectedActions);

Wyświetl plik

@ -1,5 +1,3 @@
import { Map as ImmutableMap } from 'immutable';
import { __stub } from 'soapbox/api';
import { mockStore } from 'soapbox/jest/test-helpers';
@ -19,7 +17,7 @@ describe('preloadMastodon()', () => {
.reply(200, {});
});
const store = mockStore(ImmutableMap());
const store = mockStore({});
store.dispatch(preloadMastodon(data));
const actions = store.getActions();