Skip to content

Commit 48e3ab3

Browse files
committed
test: add test
1 parent 9d27350 commit 48e3ab3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/specs/utils/object.spec.ts

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { expect } from 'chai';
22
import { deepAssign } from '../../../src/shared/object';
3+
import { addScopeOptions } from '../../../src/scopes/scope-service';
34

45
describe('utils', () => {
56
describe('object', () => {
@@ -109,6 +110,14 @@ describe('utils', () => {
109110
expect(copy.test).to.have.property('protoFn').that.is.a('function');
110111
});
111112

113+
it('ignore prototype property', () => {
114+
const BAD_JSON = JSON.parse('{"__proto__":{"polluted":true}}');
115+
const empty_scope = {};
116+
117+
addScopeOptions(empty_scope, BAD_JSON);
118+
expect(empty_scope).not.to.have.property('polluted');
119+
});
120+
112121
if (Object.getOwnPropertySymbols) {
113122
it('should copy symbol based objects', () => {
114123
const symbol = Symbol('test');

0 commit comments

Comments
 (0)