Update tests, apply formatting
This commit is contained in:
parent
f469c1de67
commit
786aca82f1
12 changed files with 70 additions and 24 deletions
|
@ -28,13 +28,25 @@ const setup = () => {
|
|||
};
|
||||
|
||||
describe("theme.tsx", () => {
|
||||
it("setTheme test", () => {
|
||||
it("setTheme light test", () => {
|
||||
setup();
|
||||
|
||||
setTheme(props);
|
||||
expect(window.localStorage.setItem).toHaveBeenCalledTimes(1);
|
||||
setTheme("light", props);
|
||||
expect(window.localStorage.setItem).toHaveBeenCalledTimes(2);
|
||||
expect(window.localStorage.setItem).toHaveBeenCalledWith(
|
||||
"theme",
|
||||
"light-theme",
|
||||
JSON.stringify(props),
|
||||
);
|
||||
expect(window.location.reload).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("setTheme dark test", () => {
|
||||
setup();
|
||||
|
||||
setTheme("dark", props);
|
||||
expect(window.localStorage.setItem).toHaveBeenCalledTimes(2);
|
||||
expect(window.localStorage.setItem).toHaveBeenCalledWith(
|
||||
"dark-theme",
|
||||
JSON.stringify(props),
|
||||
);
|
||||
expect(window.location.reload).toHaveBeenCalledTimes(1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue