Refactored ServerError to infer error message based on provided server type guards

This commit is contained in:
Alejandro Celaya
2020-08-29 10:53:02 +02:00
parent f40ad91ea9
commit 8cc0695ee9
14 changed files with 177 additions and 186 deletions

View File

@@ -1,16 +1,17 @@
import React from 'react';
import { shallow } from 'enzyme';
import { shallow, ShallowWrapper } from 'enzyme';
import { Button } from 'reactstrap';
import { Mock } from 'ts-mockery';
import createErrorHandler from '../../src/common/ErrorHandler';
describe('<ErrorHandler />', () => {
const window = {
const window = Mock.of<Window>({
location: {
reload: jest.fn(),
},
};
const console = { error: jest.fn() };
let wrapper;
});
const console = Mock.of<Console>({ error: jest.fn() });
let wrapper: ShallowWrapper;
beforeEach(() => {
const ErrorHandler = createErrorHandler(window, console);