chore: add vitest script, example unit test
This commit is contained in:
parent
7369cea4d2
commit
ea96ec8553
2 changed files with 18 additions and 1 deletions
|
|
@ -7,7 +7,9 @@
|
|||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "tsc && vite build",
|
||||
"preview": "vite preview"
|
||||
"preview": "vite preview",
|
||||
"test": "vitest",
|
||||
"test:ui": "vitest --ui"
|
||||
},
|
||||
"dependencies": {
|
||||
"@headlessui/react": "^1.7.17",
|
||||
|
|
|
|||
15
gui/src/util/localStorage.test.ts
Normal file
15
gui/src/util/localStorage.test.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import { setLocalStorage } from "./localStorage";
|
||||
|
||||
describe("localStorage Test", () => {
|
||||
beforeEach(() => {
|
||||
localStorage.clear();
|
||||
});
|
||||
|
||||
it("should stringify and set value in localStorage", () => {
|
||||
const MOCK_ONBOARDING_STATUS_VALUE = "Started";
|
||||
setLocalStorage("onboardingStatus", MOCK_ONBOARDING_STATUS_VALUE);
|
||||
expect(JSON.parse(localStorage.getItem("onboardingStatus") || "")).toEqual(
|
||||
MOCK_ONBOARDING_STATUS_VALUE,
|
||||
);
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Reference in a new issue