summaryrefslogtreecommitdiff
path: root/node_modules/object-keys/test
diff options
context:
space:
mode:
authorLinuxWizard42 <computerwizard@linuxmail.org>2022-10-12 23:08:57 +0300
committerLinuxWizard42 <computerwizard@linuxmail.org>2022-10-12 23:08:57 +0300
commit726b81b19251674e149ccfbb1abacbd837fc6db0 (patch)
treefbdbb227dc01357eb76e8222d76185bc124c5ca6 /node_modules/object-keys/test
parent34f0890e175698940d49238097579f44e4d78c89 (diff)
downloadFlashRunner-726b81b19251674e149ccfbb1abacbd837fc6db0.tar.gz
FlashRunner-726b81b19251674e149ccfbb1abacbd837fc6db0.tar.zst
Removed files that should not have been included in git
Diffstat (limited to 'node_modules/object-keys/test')
-rw-r--r--node_modules/object-keys/test/foreach.js156
-rw-r--r--node_modules/object-keys/test/index.js6
-rw-r--r--node_modules/object-keys/test/isArguments.js10
-rw-r--r--node_modules/object-keys/test/shim.js134
4 files changed, 0 insertions, 306 deletions
diff --git a/node_modules/object-keys/test/foreach.js b/node_modules/object-keys/test/foreach.js
deleted file mode 100644
index f29f065..0000000
--- a/node_modules/object-keys/test/foreach.js
+++ /dev/null
@@ -1,156 +0,0 @@
-var test = require('tape');
-var forEach = require('../foreach.js');
-
-test('second argument: iterator', function (t) {
- var arr = [];
- t.throws(function () { forEach(arr); }, TypeError, 'undefined is not a function');
- t.throws(function () { forEach(arr, null); }, TypeError, 'null is not a function');
- t.throws(function () { forEach(arr, ''); }, TypeError, 'string is not a function');
- t.throws(function () { forEach(arr, /a/); }, TypeError, 'regex is not a function');
- t.throws(function () { forEach(arr, true); }, TypeError, 'true is not a function');
- t.throws(function () { forEach(arr, false); }, TypeError, 'false is not a function');
- t.throws(function () { forEach(arr, NaN); }, TypeError, 'NaN is not a function');
- t.throws(function () { forEach(arr, 42); }, TypeError, '42 is not a function');
- t.doesNotThrow(function () { forEach(arr, function () {}); }, 'function is a function');
- t.doesNotThrow(function () { forEach(arr, setTimeout); }, 'setTimeout is a function');
- if (typeof window !== 'undefined') {
- t.doesNotThrow(function () { forEach(arr, window.alert); }, 'alert is a function');
- }
- t.end();
-});
-
-test('array', function (t) {
- var arr = [1, 2, 3];
-
- t.test('iterates over every item', function (st) {
- var index = 0;
- forEach(arr, function () { index += 1; });
- st.equal(index, arr.length, 'iterates ' + arr.length + ' times');
- st.end();
- });
-
- t.test('first iterator argument', function (st) {
- var index = 0;
- st.plan(arr.length);
- forEach(arr, function (item) {
- st.equal(arr[index], item, 'item ' + index + ' is passed as first argument');
- index += 1;
- });
- st.end();
- });
-
- t.test('second iterator argument', function (st) {
- var counter = 0;
- st.plan(arr.length);
- forEach(arr, function (item, index) {
- st.equal(counter, index, 'index ' + index + ' is passed as second argument');
- counter += 1;
- });
- st.end();
- });
-
- t.test('third iterator argument', function (st) {
- st.plan(arr.length);
- forEach(arr, function (item, index, array) {
- st.deepEqual(arr, array, 'array is passed as third argument');
- });
- st.end();
- });
-
- t.test('context argument', function (st) {
- var context = {};
- st.plan(arr.length);
- forEach(arr, function () {
- st.equal(this, context, '"this" is the passed context');
- }, context);
- st.end();
- });
-
- t.end();
-});
-
-test('object', function (t) {
- var obj = {
- a: 1,
- b: 2,
- c: 3
- };
- var keys = ['a', 'b', 'c'];
-
- var F = function () {
- this.a = 1;
- this.b = 2;
- };
- F.prototype.c = 3;
- var fKeys = ['a', 'b'];
-
- t.test('iterates over every object literal key', function (st) {
- var counter = 0;
- forEach(obj, function () { counter += 1; });
- st.equal(counter, keys.length, 'iterated ' + counter + ' times');
- st.end();
- });
-
- t.test('iterates only over own keys', function (st) {
- var counter = 0;
- forEach(new F(), function () { counter += 1; });
- st.equal(counter, fKeys.length, 'iterated ' + fKeys.length + ' times');
- st.end();
- });
-
- t.test('first iterator argument', function (st) {
- var index = 0;
- st.plan(keys.length);
- forEach(obj, function (item) {
- st.equal(obj[keys[index]], item, 'item at key ' + keys[index] + ' is passed as first argument');
- index += 1;
- });
- st.end();
- });
-
- t.test('second iterator argument', function (st) {
- var counter = 0;
- st.plan(keys.length);
- forEach(obj, function (item, key) {
- st.equal(keys[counter], key, 'key ' + key + ' is passed as second argument');
- counter += 1;
- });
- st.end();
- });
-
- t.test('third iterator argument', function (st) {
- st.plan(keys.length);
- forEach(obj, function (item, key, object) {
- st.deepEqual(obj, object, 'object is passed as third argument');
- });
- st.end();
- });
-
- t.test('context argument', function (st) {
- var context = {};
- st.plan(1);
- forEach({foo: 'bar'}, function () {
- st.equal(this, context, '"this" is the passed context');
- }, context);
- st.end();
- });
-
- t.end();
-});
-
-
-test('string', function (t) {
- var str = 'str';
- t.test('second iterator argument', function (st) {
- var counter = 0;
- st.plan(str.length * 2 + 1);
- forEach(str, function (item, index) {
- st.equal(counter, index, 'index ' + index + ' is passed as second argument');
- st.equal(str.charAt(index), item);
- counter += 1;
- });
- st.equal(counter, str.length, 'iterates ' + str.length + ' times');
- });
- t.end();
-});
-
diff --git a/node_modules/object-keys/test/index.js b/node_modules/object-keys/test/index.js
deleted file mode 100644
index 8b77b1f..0000000
--- a/node_modules/object-keys/test/index.js
+++ /dev/null
@@ -1,6 +0,0 @@
-
-require('./foreach');
-require('./isArguments');
-
-require('./shim');
-
diff --git a/node_modules/object-keys/test/isArguments.js b/node_modules/object-keys/test/isArguments.js
deleted file mode 100644
index 62a07c2..0000000
--- a/node_modules/object-keys/test/isArguments.js
+++ /dev/null
@@ -1,10 +0,0 @@
-var test = require('tape');
-var isArguments = require('../isArguments');
-
-test('is.arguments', function (t) {
- t.notOk(isArguments([]), 'array is not arguments');
- (function () { t.ok(isArguments(arguments), 'arguments is arguments'); }());
- (function () { t.notOk(isArguments(Array.prototype.slice.call(arguments)), 'sliced arguments is not arguments'); }());
- t.end();
-});
-
diff --git a/node_modules/object-keys/test/shim.js b/node_modules/object-keys/test/shim.js
deleted file mode 100644
index 9d93271..0000000
--- a/node_modules/object-keys/test/shim.js
+++ /dev/null
@@ -1,134 +0,0 @@
-var test = require('tape');
-var shimmedKeys = require('../index.js');
-var is = require('is');
-var keys = require('../shim.js');
-var forEach = require('foreach');
-var indexOf = require('indexof');
-
-var obj = {
- "str": "boz",
- "obj": {},
- "arr": [],
- "bool": true,
- "num": 42,
- "aNull": null,
- "undef": undefined
-};
-var objKeys = ['str', 'obj', 'arr', 'bool', 'num', 'aNull', 'undef'];
-
-test('exports a function', function (t) {
- if (Object.keys) {
- t.equal(Object.keys, shimmedKeys, 'Object.keys is supported and exported');
- } else {
- t.equal(keys, shimmedKeys, 'Object.keys is not supported; shim is exported');
- }
- t.end();
-});
-
-test('working with actual shim', function (t) {
- t.notEqual(Object.keys, keys, 'keys shim is not native Object.keys');
- t.end();
-});
-
-test('works with an object literal', function (t) {
- var theKeys = keys(obj);
- t.equal(is.array(theKeys), true, 'returns an array');
- t.deepEqual(theKeys, objKeys, 'Object has expected keys');
- t.end();
-});
-
-test('works with an array', function (t) {
- var arr = [1, 2, 3];
- var theKeys = keys(arr);
- t.equal(is.array(theKeys), true, 'returns an array');
- t.deepEqual(theKeys, ['0', '1', '2'], 'Array has expected keys');
- t.end();
-});
-
-test('works with a function', function (t) {
- var foo = function () {};
- foo.a = true;
-
- t.doesNotThrow(function () { return keys(foo); }, 'does not throw an error');
- t.deepEqual(keys(foo), ['a'], 'returns expected keys');
- t.end();
-});
-
-test('returns names which are own properties', function (t) {
- forEach(keys(obj), function (name) {
- t.equal(obj.hasOwnProperty(name), true, name + ' should be returned');
- });
- t.end();
-});
-
-test('returns names which are enumerable', function (t) {
- var k, loopedValues = [];
- for (k in obj) {
- loopedValues.push(k);
- }
- forEach(keys(obj), function (name) {
- t.notEqual(indexOf(loopedValues, name), -1, name + ' is not enumerable');
- });
- t.end();
-});
-
-test('throws an error for a non-object', function (t) {
- t.throws(
- function () { return keys(42); },
- new TypeError('Object.keys called on a non-object'),
- 'throws on a non-object'
- );
- t.end();
-});
-
-test('works with an object instance', function (t) {
- var Prototype = function () {};
- Prototype.prototype.foo = true;
- var obj = new Prototype();
- obj.bar = true;
- var theKeys = keys(obj);
- t.equal(is.array(theKeys), true, 'returns an array');
- t.deepEqual(theKeys, ['bar'], 'Instance has expected keys');
- t.end();
-});
-
-test('works in iOS 5 mobile Safari', function (t) {
- var Foo = function () {};
- Foo.a = function () {};
-
- // the bug is keys(Foo) => ['a', 'prototype'] instead of ['a']
- t.deepEqual(keys(Foo), ['a'], 'has expected keys');
- t.end();
-});
-
-test('works in environments with the dontEnum bug (IE < 9)', function (t) {
- var Foo = function () {};
- Foo.prototype.a = function () {};
-
- // the bug is keys(Foo.prototype) => ['a', 'constructor'] instead of ['a']
- t.deepEqual(keys(Foo.prototype), ['a'], 'has expected keys');
- t.end();
-});
-
-test('shadowed properties', function (t) {
- var shadowedProps = [
- 'dummyControlProp', /* just to be sure */
- 'constructor',
- 'hasOwnProperty',
- 'isPrototypeOf',
- 'propertyIsEnumerable',
- 'toLocaleString',
- 'toString',
- 'valueOf'
- ];
- shadowedProps.sort();
- var shadowedObject = {};
- forEach(shadowedProps, function (value, index) {
- shadowedObject[value] = index;
- });
- var shadowedObjectKeys = keys(shadowedObject);
- shadowedObjectKeys.sort();
- t.deepEqual(shadowedObjectKeys, shadowedProps, 'troublesome shadowed properties are keys of object literals');
- t.end();
-});
-