release: WRNexusJS 0.4.0
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
getOriginalRequestPath,
|
||||
getOriginalRequestUrl,
|
||||
redirectToLogin,
|
||||
stableStringify,
|
||||
} from "../src/index.ts";
|
||||
|
||||
function context(url: string, headers: HeadersInit = {}) {
|
||||
@@ -133,3 +134,13 @@ test("supports an allowed-host callback and custom response options", () => {
|
||||
expect(location.searchParams.get("tenant")).toBe("acme");
|
||||
expect(location.searchParams.get("next")).toBe("https://reports.example.test/");
|
||||
});
|
||||
|
||||
test("stableStringify permits repeated references but rejects cycles", () => {
|
||||
const shared = { value: 1 };
|
||||
expect(stableStringify({ second: shared, first: shared })).toBe(
|
||||
'{"first":{"value":1},"second":{"value":1}}',
|
||||
);
|
||||
const circular: { self?: unknown } = {};
|
||||
circular.self = circular;
|
||||
expect(() => stableStringify(circular)).toThrow("circular");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user