WIP - add extractor, generate snippet_data
This commit is contained in:
11
node_modules/object.fromentries/test/.eslintrc
generated
vendored
Normal file
11
node_modules/object.fromentries/test/.eslintrc
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"rules": {
|
||||
"array-bracket-newline": 0,
|
||||
"array-element-newline": 0,
|
||||
"max-nested-callbacks": [2, 3],
|
||||
"max-statements": [2, 12],
|
||||
"max-statements-per-line": [2, { "max": 3 }],
|
||||
"no-invalid-this": 1,
|
||||
"object-curly-newline": 0,
|
||||
}
|
||||
}
|
||||
17
node_modules/object.fromentries/test/index.js
generated
vendored
Normal file
17
node_modules/object.fromentries/test/index.js
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
'use strict';
|
||||
|
||||
var fromEntries = require('../');
|
||||
var test = require('tape');
|
||||
var runTests = require('./tests');
|
||||
|
||||
test('as a function', function (t) {
|
||||
t.test('bad array/this value', function (st) {
|
||||
st['throws'](function () { fromEntries(undefined); }, TypeError, 'undefined is not an object');
|
||||
st['throws'](function () { fromEntries(null); }, TypeError, 'null is not an object');
|
||||
st.end();
|
||||
});
|
||||
|
||||
runTests(fromEntries, t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
36
node_modules/object.fromentries/test/shimmed.js
generated
vendored
Normal file
36
node_modules/object.fromentries/test/shimmed.js
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
'use strict';
|
||||
|
||||
var fromEntries = require('../');
|
||||
fromEntries.shim();
|
||||
|
||||
var test = require('tape');
|
||||
var defineProperties = require('define-properties');
|
||||
var isEnumerable = Object.prototype.propertyIsEnumerable;
|
||||
var functionsHaveNames = function f() {}.name === 'f';
|
||||
|
||||
var runTests = require('./tests');
|
||||
|
||||
test('shimmed', function (t) {
|
||||
t.equal(Object.fromEntries.length, 1, 'Object.fromEntries has a length of 1');
|
||||
t.test('Function name', { skip: !functionsHaveNames }, function (st) {
|
||||
st.equal(Object.fromEntries.name, 'fromEntries', 'Object.fromEntries has name "fromEntries"');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) {
|
||||
et.equal(false, isEnumerable.call(Object, 'fromEntries'), 'Object.fromEntries is not enumerable');
|
||||
et.end();
|
||||
});
|
||||
|
||||
var supportsStrictMode = (function () { return typeof this === 'undefined'; }());
|
||||
|
||||
t.test('bad object value', { skip: !supportsStrictMode }, function (st) {
|
||||
st['throws'](function () { return Object.fromEntries(undefined); }, TypeError, 'undefined is not an object');
|
||||
st['throws'](function () { return Object.fromEntries(null); }, TypeError, 'null is not an object');
|
||||
st.end();
|
||||
});
|
||||
|
||||
runTests(Object.fromEntries, t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
19
node_modules/object.fromentries/test/tests.js
generated
vendored
Normal file
19
node_modules/object.fromentries/test/tests.js
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
/* global Symbol */
|
||||
|
||||
// var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';
|
||||
|
||||
module.exports = function (fromEntries, t) {
|
||||
var a = {};
|
||||
var b = {};
|
||||
var c = {};
|
||||
var entries = [['a', a], ['b', b], ['c', c]];
|
||||
var obj = { a: a, b: b, c: c };
|
||||
|
||||
t.deepEqual(fromEntries(entries), obj, 'entries -> obj');
|
||||
|
||||
t['throws'](function () { fromEntries(); }, 'entries throws on absent iterable');
|
||||
t['throws'](function () { fromEntries(undefined); }, 'entries throws on undefined');
|
||||
t['throws'](function () { fromEntries(null); }, 'entries throws on null');
|
||||
};
|
||||
Reference in New Issue
Block a user