Skip to content

Commit 4e73d31

Browse files
afzalsayed96lukeed
authored andcommitted
chore: add failing assertion (#11)
1 parent eabd71f commit 4e73d31

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Diff for: test/index.js

+19
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,25 @@ test('constructor :: pollution', t => {
106106
});
107107

108108

109+
test('prototype :: pollution', t => {
110+
const payload = '{"__proto__":{"a0":true}}';
111+
112+
const input = JSON.parse(payload);
113+
const output = klona(input);
114+
115+
t.deepEqual(
116+
JSON.stringify(output),
117+
payload
118+
);
119+
120+
t.not(({})['a0'], true, 'Safe POJO');
121+
t.not(input['a0'], true, 'Safe input');
122+
t.not(output['a0'], true, 'Safe output');
123+
124+
t.end();
125+
});
126+
127+
109128
test('date', t => {
110129
const input = new Date;
111130
const output = klona(input);

0 commit comments

Comments
 (0)