From fcd99434a02e0867b4fcc20dde9c7237b7fdb484 Mon Sep 17 00:00:00 2001 From: Bastian Meissner Date: Fri, 26 Nov 2021 21:15:59 +0100 Subject: [PATCH] Update tests for better coverage --- .../components/__snapshots__/select.spec.tsx.snap | 4 ---- src/test/lib/theme.spec.tsx | 12 +++++++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/test/components/__snapshots__/select.spec.tsx.snap b/src/test/components/__snapshots__/select.spec.tsx.snap index 1e270e2..1441de6 100644 --- a/src/test/components/__snapshots__/select.spec.tsx.snap +++ b/src/test/components/__snapshots__/select.spec.tsx.snap @@ -1,7 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`select.tsx Tests \`current\`-value 1`] = `[Function]`; - exports[`select.tsx Tests \`current\`-value with testId 1`] = `[Function]`; exports[`select.tsx Tests \`current\`-value without testId 1`] = `[Function]`; @@ -9,5 +7,3 @@ exports[`select.tsx Tests \`current\`-value without testId 1`] = `[Function]`; exports[`select.tsx Tests Select rendering 1`] = `[Function]`; exports[`select.tsx Tests rendering of multiple Select elements 1`] = `[Function]`; - -exports[`select.tsx Tests select rendering 1`] = `[Function]`; diff --git a/src/test/lib/theme.spec.tsx b/src/test/lib/theme.spec.tsx index 59ff6c5..250dea4 100644 --- a/src/test/lib/theme.spec.tsx +++ b/src/test/lib/theme.spec.tsx @@ -1,4 +1,4 @@ -import { getTheme, IThemeProps, setTheme } from "../../lib/useTheme"; +import { getTheme, IThemeProps, setScheme, setTheme } from "../../lib/useTheme"; const props: IThemeProps = { label: "Classic", @@ -28,6 +28,16 @@ const setup = () => { }; describe("theme.tsx", () => { + it("Tests setScheme", () => { + setup(); + + let value = "dark"; + + setScheme(value); + expect(window.localStorage.setItem).toHaveBeenCalledTimes(1); + expect(window.localStorage.setItem).toHaveBeenCalledWith("theme", value); + }); + it("setTheme light test", () => { setup();