Skip to content
Source
Sign inSign up
fuko/trytanstackdb-v2
Open History to see the last commit

guide-store.test.ts

25 lines948 Bytes

1import { describe, expect, it } from "vite-plus/test";
2​
3import { getDoneSections, isSectionDone, markSectionDone, markSectionNotDone } from "./guide-store";
4​
5describe("section progress", () => {
6 it("marks sections done and undone", () => {
7 expect(isSectionDone("optimistic-updates")).toBe(false);
8 markSectionDone("optimistic-updates");
9 expect(isSectionDone("optimistic-updates")).toBe(true);
10 markSectionNotDone("optimistic-updates");
11 expect(isSectionDone("optimistic-updates")).toBe(false);
12 });
13​
14 it("keeps the same snapshot when nothing changes", () => {
15 markSectionDone("rollbacks");
16 const snapshot = getDoneSections();
17 markSectionDone("rollbacks");
18 markSectionNotDone("aggregations");
19 expect(getDoneSections()).toBe(snapshot);
20​
21 markSectionDone("aggregations");
22 expect(getDoneSections()).not.toBe(snapshot);
23 expect([...getDoneSections()]).toEqual(["rollbacks", "aggregations"]);
24 });
25});