Update tests for better coverage

This commit is contained in:
Bastian Meissner 2021-11-26 21:15:59 +01:00
parent a24579420a
commit fcd99434a0
2 changed files with 11 additions and 5 deletions

View file

@ -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]`;

View file

@ -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();