Skip to content

Commit d5700c0

Browse files
committed
test(config): focus prototype restore regression
1 parent 5bbae9a commit d5700c0

2 files changed

Lines changed: 11 additions & 16 deletions

File tree

src/config/redact-snapshot.restore.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,16 @@ describe("restoreRedactedValues", () => {
100100
expect(restoreRedactedValues_orig(incoming, original).ok).toBe(false);
101101
});
102102

103+
it.each(["toString", "constructor", "valueOf", "hasOwnProperty"])(
104+
"rejects inherited %s values when the original key is missing",
105+
(key) => {
106+
const hints = { [key]: { sensitive: true } };
107+
const result = restoreRedactedValues_orig({ [key]: REDACTED_SENTINEL }, {}, hints);
108+
109+
expect(result.ok).toBe(false);
110+
},
111+
);
112+
103113
it("rejects invalid restore inputs", () => {
104114
const invalidInputs = [null, undefined, "token-value"] as const;
105115
for (const input of invalidInputs) {

src/config/redact-snapshot.test.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ import JSON5 from "json5";
33
import { describe, expect, it } from "vitest";
44
import { redactSnapshotTestHints as mainSchemaHints } from "../../test/helpers/config/redact-snapshot-test-hints.js";
55
import { materializeRuntimeConfig } from "./materialize.js";
6-
import {
7-
REDACTED_SENTINEL,
8-
redactConfigSnapshot,
9-
restoreRedactedValues as restoreRedactedRaw,
10-
} from "./redact-snapshot.js";
6+
import { REDACTED_SENTINEL, redactConfigSnapshot } from "./redact-snapshot.js";
117
import {
128
makeSnapshot,
139
restoreRedactedValues,
@@ -1382,15 +1378,4 @@ describe("redactConfigSnapshot", () => {
13821378
);
13831379
expect(restored.browser.profiles.local.cdpUrl).toBe("ws://localhost:9222");
13841380
});
1385-
1386-
it("rejects prototype-named missing keys instead of returning functions", () => {
1387-
const PROTOTYPE_KEYS = ["toString", "constructor", "valueOf", "hasOwnProperty"];
1388-
for (const key of PROTOTYPE_KEYS) {
1389-
const redacted = { [key]: REDACTED_SENTINEL };
1390-
const original = {};
1391-
const hints = { [key]: { sensitive: true, label: "test" } };
1392-
const result = restoreRedactedRaw(redacted, original, hints);
1393-
expect(result.ok).toBe(false);
1394-
}
1395-
});
13961381
});

0 commit comments

Comments
 (0)