Don't redact null or undefined

This commit is contained in:
Johannes Marbach
2026-06-24 13:35:44 +02:00
parent 51bd17d335
commit f376ffb96b
2 changed files with 32 additions and 2 deletions

View File

@@ -34,3 +34,25 @@ test("no redaction of unrelated keys", () => {
bar: "foo",
});
});
test("no redaction of missing keys", () => {
expect(
redact({ foo: "bar" } as { foo: string; bar: string | undefined }, "bar"),
).to.deep.equal({
foo: "bar",
});
});
test("no redaction of null values", () => {
expect(redact({ foo: "bar", bar: null }, "bar")).to.deep.equal({
foo: "bar",
bar: null,
});
});
test("no redaction of undefined values", () => {
expect(redact({ foo: "bar", bar: undefined }, "bar")).to.deep.equal({
foo: "bar",
bar: undefined,
});
});