Skip to content

Commit

Permalink
test: add test
Browse files Browse the repository at this point in the history
  • Loading branch information
WikiRik committed Nov 24, 2023
1 parent 9d27350 commit 48e3ab3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/specs/utils/object.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { expect } from 'chai';
import { deepAssign } from '../../../src/shared/object';
import { addScopeOptions } from '../../../src/scopes/scope-service';

describe('utils', () => {
describe('object', () => {
Expand Down Expand Up @@ -109,6 +110,14 @@ describe('utils', () => {
expect(copy.test).to.have.property('protoFn').that.is.a('function');
});

it('ignore prototype property', () => {
const BAD_JSON = JSON.parse('{"__proto__":{"polluted":true}}');
const empty_scope = {};

addScopeOptions(empty_scope, BAD_JSON);
expect(empty_scope).not.to.have.property('polluted');
});

if (Object.getOwnPropertySymbols) {
it('should copy symbol based objects', () => {
const symbol = Symbol('test');
Expand Down

0 comments on commit 48e3ab3

Please sign in to comment.