From cdb984bf20207ac847f7c68f3801d3ff6d2f0bb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Tue, 27 Oct 2020 18:42:59 +0000 Subject: [PATCH] fix(tests): fix eslint warnings --- ui/src/Components/NavBar/FilterInput/index.test.tsx | 1 - ui/src/__fixtures__/Fetch.ts | 7 +++++-- ui/src/__fixtures__/matchMedia.ts | 9 ++++++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ui/src/Components/NavBar/FilterInput/index.test.tsx b/ui/src/Components/NavBar/FilterInput/index.test.tsx index 4e1370f4e..3a43ab71f 100644 --- a/ui/src/Components/NavBar/FilterInput/index.test.tsx +++ b/ui/src/Components/NavBar/FilterInput/index.test.tsx @@ -8,7 +8,6 @@ import toDiffableHtml from "diffable-html"; import { useFetchGetMock } from "__fixtures__/useFetchGet"; import { AlertStore, NewUnappliedFilter } from "Stores/AlertStore"; import { Settings } from "Stores/Settings"; -import { useFetchGet } from "Hooks/useFetchGet"; import { FilterInput } from "."; let alertStore: AlertStore; diff --git a/ui/src/__fixtures__/Fetch.ts b/ui/src/__fixtures__/Fetch.ts index 202d0eed6..feada2313 100644 --- a/ui/src/__fixtures__/Fetch.ts +++ b/ui/src/__fixtures__/Fetch.ts @@ -86,7 +86,7 @@ const EmptyAPIResponse = (): APIAlertsResponseT => ({ }, }); -const MockAPIResponse = () => { +const MockAPIResponse = (): APIAlertsResponseT => { const response = EmptyAPIResponse(); response.grids = [ { @@ -112,7 +112,10 @@ const MockAPIResponse = () => { return response; }; -const MockSilenceResponse = (cluster: string, count: number) => { +const MockSilenceResponse = ( + cluster: string, + count: number +): APIManagedSilenceT[] => { const silences: APIManagedSilenceT[] = []; for (let index = 1; index <= count; index++) { const silence = MockSilence(); diff --git a/ui/src/__fixtures__/matchMedia.ts b/ui/src/__fixtures__/matchMedia.ts index 34924cc0c..0840253bd 100644 --- a/ui/src/__fixtures__/matchMedia.ts +++ b/ui/src/__fixtures__/matchMedia.ts @@ -1,4 +1,11 @@ -const mockMatchMedia = (mapOfMedia: any) => { +interface mapOfMediaT { + matches: boolean; + media: string; +} + +const mockMatchMedia = (mapOfMedia: { + [query: string]: mapOfMediaT; +}): jest.MockedFunction => { return jest.fn().mockImplementation((query) => { return { matches: mapOfMedia[query] ? mapOfMedia[query].matches : false,