fix(tests): mock fetch for LabelValueInput tests

Gettings lots of nodejs warnings about unhandled fetch errors due to lack of mocks for suggestion fetch requests, add mocks to supress those
This commit is contained in:
Łukasz Mierzwa
2019-04-03 14:16:23 -07:00
parent 2509704190
commit dfe9cb1426

View File

@@ -14,6 +14,10 @@ import { LabelValueInput } from "./LabelValueInput";
let silenceFormStore;
let matcher;
beforeAll(() => {
fetch.mockResponse(JSON.stringify([]));
});
beforeEach(() => {
silenceFormStore = new SilenceFormStore();
matcher = NewEmptyMatcher();
@@ -28,6 +32,10 @@ beforeEach(() => {
];
});
afterEach(() => {
jest.restoreAllMocks();
});
const ShallowLabelValueInput = isValid => {
return shallow(
<LabelValueInput