Skip to content

Commit

Permalink
[Tests] use define-{accessor,data}-property
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Feb 17, 2024
1 parent 1723b4b commit 213bc42
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@
"aud": "^2.0.4",
"available-regexp-flags": "^1.0.2",
"cheerio": "=1.0.0-rc.3",
"define-accessor-property": "^1.0.0",
"define-data-property": "^1.1.4",
"diff": "^5.1.0",
"eclint": "^2.8.1",
"es-value-fixtures": "^1.4.2",
Expand Down
11 changes: 6 additions & 5 deletions test/helpers/OwnPropertyKeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
var test = require('tape');
var hasSymbols = require('has-symbols')();
var $defineProperty = require('es-define-property');
var defineAccessorProperty = require('define-accessor-property');
var defineDataProperty = require('define-data-property');

var OwnPropertyKeys = require('../../helpers/OwnPropertyKeys');
var defineProperty = require('./defineProperty');

test('OwnPropertyKeys', function (t) {
t.deepEqual(OwnPropertyKeys({ a: 1, b: 2 }).sort(), ['a', 'b'].sort(), 'returns own string keys');
Expand All @@ -22,12 +23,12 @@ test('OwnPropertyKeys', function (t) {

t.test('non-enumerables', { skip: !$defineProperty }, function (st) {
var o = { a: 1, b: 42, c: NaN };
defineProperty(o, 'b', { enumerable: false, value: 42 });
defineProperty(o, 'c', { enumerable: false, get: function () { return NaN; } });
defineDataProperty(o, 'b', { nonEnumerable: true, value: 42 });
defineAccessorProperty(o, 'c', { nonEnumerable: true, get: function () { return NaN; } });

if (hasSymbols) {
defineProperty(o, 'd', { enumerable: false, value: true });
defineProperty(o, 'e', { enumerable: false, get: function () { return true; } });
defineDataProperty(o, 'd', { nonEnumerable: true, value: true });
defineAccessorProperty(o, 'e', { nonEnumerable: true, get: function () { return true; } });
}

st.deepEqual(
Expand Down

0 comments on commit 213bc42

Please sign in to comment.