mirror of
https://github.com/hanzoai/calendar.git
synced 2026-09-24 22:42:24 +00:00
27 lines
878 B
TypeScript
27 lines
878 B
TypeScript
import { describe, it, expect } from "vitest";
|
|
import { hashEmail, Md5PiiHasher } from "./PiiHasher";
|
|
|
|
describe("PII Hasher Test Suite", () => {
|
|
|
|
const hasher = new Md5PiiHasher("test-salt");
|
|
|
|
it("can hash email addresses", async () => {
|
|
const email = "[email protected]";
|
|
const hashedEmail = hashEmail(email, hasher);
|
|
expect(hashedEmail).toBe("[email protected]");
|
|
});
|
|
|
|
it("can hash PII with saltyMd5", async () => {
|
|
const pii = "sensitive_data";
|
|
const hashedPii = hasher.hash(pii);
|
|
expect(hashedPii).toBe("2e74ca9edc8add1709b0d049aa2a0959");
|
|
});
|
|
|
|
it("handles hashing with different salt", () => {
|
|
const differentHasher = new Md5PiiHasher("different-salt");
|
|
const pii = "sensitive_data";
|
|
const hashedPii = differentHasher.hash(pii);
|
|
expect(hashedPii).not.toBe(hasher.hash(pii));
|
|
});
|
|
});
|