1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
|
Description: switch test from ava to tape
Author: Xavier Guimard <yadd@debian.org>
Forwarded: not-needed
Last-Update: 2019-08-28
--- a/test.js
+++ b/test.js
@@ -1,10 +1,11 @@
-import test from 'ava';
+const test = require('tape');
Object.assign = require('./');
const objectAssign = require('./');
test('have the correct length', t => {
t.is(objectAssign.length, 2);
+ t.end();
});
test('throw when target is not an object', t => {
@@ -14,6 +15,7 @@
t.throws(() => {
objectAssign(undefined);
}, TypeError);
+ t.end();
});
test('objectAssign own enumerable properties from source to target object', t => {
@@ -26,6 +28,7 @@
foo: 0,
bar: 1
});
+ t.end();
});
test('throw on null/undefined target', t => {
@@ -40,20 +43,22 @@
t.throws(() => {
objectAssign(undefined, undefined);
});
+ t.end();
});
test('not throw on null/undefined sources', t => {
- t.notThrows(() => {
+ t.doesNotThrow(() => {
objectAssign({}, null);
});
- t.notThrows(() => {
+ t.doesNotThrow(() => {
objectAssign({}, undefined);
});
- t.notThrows(() => {
+ t.doesNotThrow(() => {
objectAssign({}, undefined, null);
});
+ t.end();
});
test('support multiple sources', t => {
@@ -62,6 +67,7 @@
bar: 2
});
t.deepEqual(objectAssign({}, {}, {foo: 1}), {foo: 1});
+ t.end();
});
test('only iterate own keys', t => {
@@ -74,18 +80,21 @@
foo: 1,
bar: 1
});
+ t.end();
});
test('return the modified target object', t => {
const target = {};
const returned = objectAssign(target, {a: 1});
t.is(returned, target);
+ t.end();
});
test('support `Object.create(null)` objects', t => {
const obj = Object.create(null);
obj.foo = true;
t.deepEqual(objectAssign({}, obj), {foo: true});
+ t.end();
});
test('preserve property order', t => {
@@ -96,6 +105,7 @@
});
const target = objectAssign({}, source);
t.is(Object.keys(target).join(''), letters);
+ t.end();
});
test('accept primitives as target', t => {
@@ -103,6 +113,7 @@
const strObj = Object('abcdefg');
strObj.foo = 'bar';
t.deepEqual(target, strObj);
+ t.end();
});
if (typeof global.Symbol !== 'undefined') {
@@ -113,6 +124,7 @@
source[sym] = 'bar';
objectAssign(target, source);
t.is(target[sym], 'bar');
+ t.end();
});
test('only copy enumerable symbols', t => {
@@ -125,5 +137,6 @@
});
objectAssign(target, source);
t.is(target[sym], undefined);
+ t.end();
});
}
|