Skip to content

Commit

Permalink
test: add a test to check if arguments prototype is frozen under lock…
Browse files Browse the repository at this point in the history
…down
  • Loading branch information
naugtur committed Aug 17, 2022
1 parent fe9c784 commit 2db08f6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/ses/test/test-frozen-primordials.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,22 @@ import test from 'ava';
import '../index.js';
import { getOwnPropertyDescriptor } from '../src/commons.js';

test('check if override-protected primordials are frozen', t => {
test.before(() => {
lockdown();
});

test('check if override-protected primordials are frozen', t => {
// After removing the detachedProperties mechanism and without
// the originalValue mechanism, this test failed.
t.truthy(Object.isFrozen(Object.prototype.toString));

const desc = getOwnPropertyDescriptor(Object.prototype, 'toString');
t.is(desc.get.originalValue, Object.prototype.toString);
});

test('check if arguments prototype is frozen', t => {
(function gimmeArguments() {
// eslint-disable-next-line no-proto
t.truthy(Object.isFrozen(arguments.__proto__));
})();
});

0 comments on commit 2db08f6

Please sign in to comment.