Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
+45
@@ -0,0 +1,45 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
import { sanitizeNotificationPayloadForDisplay } from "./NotificationMessagesTable";
|
||||
|
||||
describe("NotificationMessagesTable", () => {
|
||||
it("redacts sensitive notification payload fields before display", () => {
|
||||
const payload = JSON.stringify({
|
||||
token: "secret-token",
|
||||
authorization: "Bearer abc123",
|
||||
nested: { email: "user@example.com", message: "ok" },
|
||||
});
|
||||
|
||||
const redacted = sanitizeNotificationPayloadForDisplay(payload);
|
||||
|
||||
expect(redacted).not.toContain("secret-token");
|
||||
expect(redacted).not.toContain("Bearer abc123");
|
||||
expect(redacted).toContain("[REDACTED]");
|
||||
expect(redacted).toContain("user@example.com");
|
||||
});
|
||||
|
||||
it("stringifies object payloads before redaction", () => {
|
||||
const redacted = sanitizeNotificationPayloadForDisplay({
|
||||
token: "secret-token",
|
||||
nested: { authorization: "Bearer abc123", message: "ok" },
|
||||
});
|
||||
|
||||
expect(redacted).not.toContain("secret-token");
|
||||
expect(redacted).not.toContain("Bearer abc123");
|
||||
expect(redacted).toContain("[REDACTED]");
|
||||
expect(redacted).toContain("ok");
|
||||
});
|
||||
|
||||
it("keeps notification table dates on locale-aware formatters", () => {
|
||||
const componentsRoot = path.resolve(process.cwd(), "apps/web/app/modules/notifications/components");
|
||||
const source = ["NotificationMessagesTable.tsx", "NotificationSubscribersTable.tsx"]
|
||||
.map((file) => fs.readFileSync(path.join(componentsRoot, file), "utf8"))
|
||||
.join("\n");
|
||||
|
||||
expect(source).toContain("useLocaleFormatters");
|
||||
expect(source).toContain("formatters.relativeDate");
|
||||
expect(source).not.toContain("DateUtils");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user