Browse Source

test: improve code in test-vm-preserves-property

* use const instead of var
* use assert.strictEqual instead assert.equal

PR-URL https://github.com/nodejs/node/pull/10428
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
v6
Adrian Estrada 8 years ago
committed by Luigi Pinca
parent
commit
89c8f58921
  1. 22
      test/parallel/test-vm-preserves-property.js

22
test/parallel/test-vm-preserves-property.js

@ -1,25 +1,25 @@
'use strict'; 'use strict';
require('../common'); require('../common');
var assert = require('assert'); const assert = require('assert');
var vm = require('vm'); const vm = require('vm');
var x = {}; const x = {};
Object.defineProperty(x, 'prop', { Object.defineProperty(x, 'prop', {
configurable: false, configurable: false,
enumerable: false, enumerable: false,
writable: false, writable: false,
value: 'val' value: 'val'
}); });
var o = vm.createContext(x); const o = vm.createContext(x);
var code = 'Object.getOwnPropertyDescriptor(this, "prop")'; const code = 'Object.getOwnPropertyDescriptor(this, "prop")';
var res = vm.runInContext(code, o, 'test'); const res = vm.runInContext(code, o, 'test');
assert(res); assert(res);
assert.equal(typeof res, 'object'); assert.strictEqual(typeof res, 'object');
assert.equal(res.value, 'val'); assert.strictEqual(res.value, 'val');
assert.equal(res.configurable, false, 'should not be configurable'); assert.strictEqual(res.configurable, false, 'should not be configurable');
assert.equal(res.enumerable, false, 'should not be enumerable'); assert.strictEqual(res.enumerable, false, 'should not be enumerable');
assert.equal(res.writable, false, 'should not be writable'); assert.strictEqual(res.writable, false, 'should not be writable');

Loading…
Cancel
Save