Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
+44
@@ -0,0 +1,44 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { serializeImpersonationAuditMetadata } from "./impersonation-audit.server.js";
|
||||
|
||||
describe("serializeImpersonationAuditMetadata value normalization", () => {
|
||||
it("stringifies scalar values (number, boolean, bigint)", () => {
|
||||
const serialized = serializeImpersonationAuditMetadata({
|
||||
attempts: 3,
|
||||
blocked: true,
|
||||
sequence: 9007199254740993n,
|
||||
});
|
||||
|
||||
expect(serialized).toBe(JSON.stringify({ attempts: "3", blocked: "true", sequence: "9007199254740993" }));
|
||||
});
|
||||
|
||||
it("serializes Date values as ISO-8601 strings", () => {
|
||||
const serialized = serializeImpersonationAuditMetadata({
|
||||
occurredAt: new Date("2026-06-25T08:30:00.000Z"),
|
||||
});
|
||||
|
||||
expect(serialized).toBe(JSON.stringify({ occurredAt: "2026-06-25T08:30:00.000Z" }));
|
||||
});
|
||||
|
||||
it("drops null and undefined values because they normalize to empty strings", () => {
|
||||
const serialized = serializeImpersonationAuditMetadata({
|
||||
ip: "127.0.0.1",
|
||||
reason: null,
|
||||
note: undefined,
|
||||
});
|
||||
|
||||
expect(serialized).toBe(JSON.stringify({ ip: "127.0.0.1" }));
|
||||
});
|
||||
|
||||
it("returns null when every value normalizes away to empty", () => {
|
||||
expect(serializeImpersonationAuditMetadata({ reason: null, note: undefined })).toBeNull();
|
||||
});
|
||||
|
||||
it("falsey-but-meaningful scalars survive normalization", () => {
|
||||
// 0 and false stringify to non-empty values, so they must be retained.
|
||||
const serialized = serializeImpersonationAuditMetadata({ count: 0, enabled: false });
|
||||
|
||||
expect(serialized).toBe(JSON.stringify({ count: "0", enabled: "false" }));
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user