Refactor
This commit is contained in:
parent
ca2f7a763d
commit
eaad2d56f0
36 changed files with 366 additions and 960 deletions
|
@ -1,46 +0,0 @@
|
|||
import { ok } from "assert";
|
||||
import useFetcher, {
|
||||
defaults,
|
||||
handleResponse,
|
||||
handleError,
|
||||
fetchProduction,
|
||||
fetchDevelopment,
|
||||
} from "../../lib/fetcher";
|
||||
|
||||
describe("fetcher.tsx", () => {
|
||||
it("Tests handleResponse", () => {});
|
||||
|
||||
it("Tests handleError", () => {
|
||||
expect(handleError("apps", Error("Test!"))).toEqual({
|
||||
...defaults.app,
|
||||
error: "Test!",
|
||||
});
|
||||
|
||||
expect(handleError("bookmark", Error("Test!"))).toEqual({
|
||||
...defaults.bookmark,
|
||||
error: "Test!",
|
||||
});
|
||||
|
||||
expect(handleError("searchProvider", Error("Test!"))).toEqual({
|
||||
...defaults.search,
|
||||
error: "Test!",
|
||||
});
|
||||
|
||||
expect(handleError("theme", Error("Test!"))).toEqual({
|
||||
...defaults.theme,
|
||||
error: "Test!",
|
||||
});
|
||||
|
||||
expect(handleError("imprint", Error("Test!"))).toEqual({
|
||||
...defaults.imprint,
|
||||
error: "Test!",
|
||||
});
|
||||
|
||||
expect(handleError("greeter", Error("Test!"))).toEqual({
|
||||
...defaults.greeter,
|
||||
error: "Test!",
|
||||
});
|
||||
|
||||
expect(handleError("", Error("Test!"))).toEqual(undefined);
|
||||
});
|
||||
});
|
|
@ -1,4 +1,4 @@
|
|||
import { getTheme, IThemeProps, setTheme } from "../../lib/useTheme";
|
||||
import { getTheme, IThemeProps, setTheme, setScheme } from "../../lib/useTheme";
|
||||
|
||||
const props: IThemeProps = {
|
||||
label: "Classic",
|
||||
|
@ -27,7 +27,15 @@ const setup = () => {
|
|||
};
|
||||
};
|
||||
|
||||
describe("theme.tsx", () => {
|
||||
describe("useTheme.tsx", () => {
|
||||
it("tests setScheme", () => {
|
||||
setup();
|
||||
|
||||
setScheme("Test");
|
||||
expect(window.localStorage.setItem).toHaveBeenCalledTimes(1);
|
||||
expect(window.localStorage.setItem).toHaveBeenCalledWith("theme", "Test");
|
||||
});
|
||||
|
||||
it("setTheme light test", () => {
|
||||
setup();
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue