Skip to content

Commit

Permalink
chore: add failing assertion (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
afzalsayed96 authored and lukeed committed Jan 13, 2020
1 parent eabd71f commit 4e73d31
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,25 @@ test('constructor :: pollution', t => {
});


test('prototype :: pollution', t => {
const payload = '{"__proto__":{"a0":true}}';

const input = JSON.parse(payload);
const output = klona(input);

t.deepEqual(
JSON.stringify(output),
payload
);

t.not(({})['a0'], true, 'Safe POJO');
t.not(input['a0'], true, 'Safe input');
t.not(output['a0'], true, 'Safe output');

t.end();
});


test('date', t => {
const input = new Date;
const output = klona(input);
Expand Down

0 comments on commit 4e73d31

Please sign in to comment.