Lift config context one level higher.

- Refactor About component to use config context.
- Update About component unit tests.
This commit is contained in:
kialam
2019-01-02 09:03:48 -07:00
committed by Jake McDermott
parent a217a387c6
commit e77d81dd5b
3 changed files with 161 additions and 259 deletions

View File

@@ -31,26 +31,4 @@ describe('<About />', () => {
expect(onAboutModalClose).toBeCalled();
aboutWrapper.unmount();
});
test('sets error on api request failure', async () => {
api.get = jest.fn().mockImplementation(() => {
const err = new Error('404 error');
err.response = { status: 404, message: 'problem' };
return Promise.reject(err);
});
aboutWrapper = mount(
<I18nProvider>
<About isOpen />
</I18nProvider>
);
const aboutComponentInstance = aboutWrapper.find(About).instance();
await aboutComponentInstance.componentDidMount();
expect(aboutComponentInstance.state.error.response.status).toBe(404);
aboutWrapper.unmount();
});
test('API Config endpoint is valid', () => {
expect(API_CONFIG).toBeDefined();
});
});