Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

Merge remote-tracking branch 'origin/main' into feature/rx-202

Amruth Pillai98333f55183b
diff --cc packages/utils/src/string.test.ts
index e5d97db3e,4c5e8d001..954e50fea
--- a/packages/utils/src/string.test.ts
+++ b/packages/utils/src/string.test.ts
@@@ -1,44 -1,7 +1,44 @@@
import { describe, expect, it, vi } from "vite-plus/test";
import { slugify } from "./slug";
- import { filterOptions, getInitials, isolate, rewriteSummary, toUsername } from "./string";
+ import { filterOptions, fitLabel, getInitials, isolate, rewriteSummary, toUsername } from "./string";
+it("retains opaque pending request IDs across module restart until acknowledgement", async () => {
+ const values = new Map<string, string>();
+ const storage = {
+ getItem: (key: string) => values.get(key) ?? null,
+ setItem: (key: string, value: string) => {
+ values.set(key, value);
+ },
+ removeItem: (key: string) => {
+ values.delete(key);
+ },
+ };
+ const key = JSON.stringify(["offer-version", "account-a", { id: "original", base: 90000 }]);
+ const first = await import("./string");
+ const id = first.pendingRequestId(key, storage);
+ vi.resetModules();
+ const restarted = await import("./string");
+ expect(restarted.pendingRequestId(key, storage)).toBe(id);
+ expect([...values.keys()].join()).not.toMatch(/account-a|original/);
+ expect(restarted.pendingRequestId(key + "another-account", storage)).not.toBe(id);
+ restarted.settleRequestId(key, storage, id);
+ const next = restarted.pendingRequestId(key, storage);
+ expect(next).not.toBe(id);
+ restarted.settleRequestId(key, storage, id);
+ expect(restarted.pendingRequestId(key, storage)).toBe(next);
+ expect(() => restarted.pendingRequestId("corrupt", { ...storage, getItem: () => "invalid" })).toThrow(
+ "Invalid pending request ID",
+ );
+ expect(() =>
+ restarted.pendingRequestId("unwritable", {
+ ...storage,
+ setItem: () => {
+ throw new Error("Disk full");
+ },
+ }),
+ ).toThrow("Disk full");
+});
+
describe("slugify", () => {
it("falls back to a non-empty slug for CJK input", () => {
expect(slugify("中文简历")).not.toBe("");