bigbuffet-rw/app/soapbox/actions/__tests__/about-test.js
2020-06-09 17:16:22 -05:00

30 lines
905 B
JavaScript

import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import {
FETCH_ABOUT_PAGE_REQUEST,
FETCH_ABOUT_PAGE_SUCCESS,
fetchAboutPage,
} from '../about';
import { Map as ImmutableMap } from 'immutable';
import { __stub as stubApi } from 'soapbox/api';
const middlewares = [thunk];
const mockStore = configureMockStore(middlewares);
describe('fetchAboutPage()', () => {
beforeEach(() => stubApi(mock => {
mock.onGet('/instance/about/index.html').reply(200, '<h1>Hello world</h1>');
}));
it('creates the expected actions', () => {
const expectedActions = [
{ type: FETCH_ABOUT_PAGE_REQUEST, slug: 'index' },
{ type: FETCH_ABOUT_PAGE_SUCCESS, slug: 'index' },
];
const store = mockStore(ImmutableMap());
return store.dispatch(fetchAboutPage()).then(() => {
expect(store.getActions()).toEqual(expectedActions);
});
});
});