Open a finished Rule from its Profile card, and drop it from the browser on Log out.
This commit is contained in:
1 parent
db1599123b
commit
942c7cc9de
17 files changed
+280
-14
No files matched your search
@@ -1,5 +1,10 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { finishedAtIso } from "../../lib/create/lastPublishedRule";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import {
|
||||
CREATE_FLOW_LAST_PUBLISHED_KEY,
|
||||
clearLastPublishedRule,
|
||||
finishedAtIso,
|
||||
writeLastPublishedRule,
|
||||
} from "../../lib/create/lastPublishedRule";
|
||||
|
||||
describe("finishedAtIso", () => {
|
||||
it("normalizes strings and dates", () => {
|
||||
@@ -17,3 +22,25 @@ describe("finishedAtIso", () => {
|
||||
expect(finishedAtIso(null)).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe("clearLastPublishedRule", () => {
|
||||
afterEach(() => {
|
||||
sessionStorage.removeItem(CREATE_FLOW_LAST_PUBLISHED_KEY);
|
||||
});
|
||||
|
||||
it("removes the stored finished Rule", () => {
|
||||
writeLastPublishedRule({
|
||||
id: "rule-1",
|
||||
title: "Garden coop",
|
||||
document: { sections: [] },
|
||||
});
|
||||
expect(sessionStorage.getItem(CREATE_FLOW_LAST_PUBLISHED_KEY)).not.toBeNull();
|
||||
clearLastPublishedRule();
|
||||
expect(sessionStorage.getItem(CREATE_FLOW_LAST_PUBLISHED_KEY)).toBeNull();
|
||||
});
|
||||
|
||||
it("does nothing when the key is already missing", () => {
|
||||
expect(() => clearLastPublishedRule()).not.toThrow();
|
||||
expect(sessionStorage.getItem(CREATE_FLOW_LAST_PUBLISHED_KEY)).toBeNull();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user