Update checked-in dependencies
This commit is contained in:
parent
1afca056e3
commit
6989ba7bd2
3942 changed files with 55190 additions and 132206 deletions
42
node_modules/safe-array-concat/test/index.js
generated
vendored
42
node_modules/safe-array-concat/test/index.js
generated
vendored
|
|
@ -6,7 +6,7 @@ var hasSymbols = require('has-symbols/shams')();
|
|||
var isConcatSpreadable = hasSymbols && Symbol.isConcatSpreadable;
|
||||
var species = hasSymbols && Symbol.species;
|
||||
|
||||
var boundFnsHaveConfigurableLengths = Object.getOwnPropertyDescriptor && Object.getOwnPropertyDescriptor(function () {}.bind(), 'length').configurable;
|
||||
var boundFnsHaveConfigurableLengths = require('set-function-length/env').boundFnsHaveConfigurableLengths;
|
||||
|
||||
var safeConcat = require('../');
|
||||
|
||||
|
|
@ -15,12 +15,12 @@ test('safe-array-concat', function (t) {
|
|||
t.equal(
|
||||
safeConcat.length,
|
||||
boundFnsHaveConfigurableLengths ? 1 : 0,
|
||||
'has a length of ' + (boundFnsHaveConfigurableLengths ? 1 : '0 (function lengths are not configurable)'),
|
||||
'length is as expected'
|
||||
'has a length of ' + (boundFnsHaveConfigurableLengths ? 1 : '0 (function lengths are not configurable)')
|
||||
);
|
||||
|
||||
t.deepEqual(
|
||||
safeConcat([1, 2], [3, 4], 'foo', 5, 6, [[7]]),
|
||||
// eslint-disable-next-line no-extra-parens
|
||||
safeConcat(/** @type {(string | number | number[])[]} */ ([1, 2]), [3, 4], 'foo', 5, 6, [[7]]),
|
||||
[1, 2, 3, 4, 'foo', 5, 6, [7]],
|
||||
'works with flat and nested arrays'
|
||||
);
|
||||
|
|
@ -48,7 +48,9 @@ test('safe-array-concat', function (t) {
|
|||
|
||||
t.test('has Symbol.species', { skip: !species }, function (st) {
|
||||
var speciesArr = [1, 2];
|
||||
// @ts-expect-error ts(2740) TS's `constructor` type requires a function
|
||||
speciesArr.constructor = {};
|
||||
// @ts-expect-error ts(2538) TS can't type narrow from tape's `skip`
|
||||
speciesArr.constructor[species] = function Species() {
|
||||
return { args: arguments };
|
||||
};
|
||||
|
|
@ -63,24 +65,28 @@ test('safe-array-concat', function (t) {
|
|||
});
|
||||
|
||||
t.test('has isConcatSpreadable', { skip: !isConcatSpreadable }, function (st) {
|
||||
st.teardown(mockProperty(String.prototype, isConcatSpreadable, { value: true }));
|
||||
// TS can't type narrow from tape's `skip`
|
||||
if (isConcatSpreadable) {
|
||||
st.teardown(mockProperty(String.prototype, isConcatSpreadable, { value: true }));
|
||||
|
||||
var nonSpreadable = [1, 2];
|
||||
nonSpreadable[isConcatSpreadable] = false;
|
||||
var nonSpreadable = [1, 2];
|
||||
// @ts-expect-error ts(7015) TS can't handle expandos on an array
|
||||
nonSpreadable[isConcatSpreadable] = false;
|
||||
|
||||
st.deepEqual(
|
||||
safeConcat(nonSpreadable, 3, 4, 'foo', Object('bar')),
|
||||
[1, 2, 3, 4, 'foo', Object('bar')],
|
||||
'a non-concat-spreadable array is spreaded, and a concat-spreadable String is not spreaded'
|
||||
);
|
||||
st.deepEqual(
|
||||
safeConcat(nonSpreadable, 3, 4, 'foo', Object('bar')),
|
||||
[1, 2, 3, 4, 'foo', Object('bar')],
|
||||
'a non-concat-spreadable array is spreaded, and a concat-spreadable String is not spreaded'
|
||||
);
|
||||
|
||||
st.teardown(mockProperty(Array.prototype, isConcatSpreadable, { value: false }));
|
||||
st.teardown(mockProperty(Array.prototype, isConcatSpreadable, { value: false }));
|
||||
|
||||
st.deepEqual(
|
||||
safeConcat([1, 2], 3, 4, 'foo', Object('bar')),
|
||||
[1, 2, 3, 4, 'foo', Object('bar')],
|
||||
'all arrays marked non-concat-spreadable are still spreaded, and a concat-spreadable String is not spreaded'
|
||||
);
|
||||
st.deepEqual(
|
||||
safeConcat([1, 2], 3, 4, 'foo', Object('bar')),
|
||||
[1, 2, 3, 4, 'foo', Object('bar')],
|
||||
'all arrays marked non-concat-spreadable are still spreaded, and a concat-spreadable String is not spreaded'
|
||||
);
|
||||
}
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue