Update npm packages (73 packages including @jqhtml 2.3.36)
Update npm registry domain from privatenpm.hanson.xyz to npm.internal.hanson.xyz 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
63
node_modules/qs/test/utils.js
generated
vendored
63
node_modules/qs/test/utils.js
generated
vendored
@@ -69,12 +69,14 @@ test('merge()', function (t) {
|
||||
);
|
||||
|
||||
t.test('with overflow objects (from arrayLimit)', function (st) {
|
||||
// arrayLimit is max index, so with limit 0, max index 0 is allowed (1 element)
|
||||
// To create overflow, need 2+ elements with limit 0, or 3+ with limit 1, etc.
|
||||
st.test('merges primitive into overflow object at next index', function (s2t) {
|
||||
// Create an overflow object via combine
|
||||
var overflow = utils.combine(['a'], 'b', 1, false);
|
||||
// Create an overflow object via combine: 3 elements (indices 0-2) with limit 0
|
||||
var overflow = utils.combine(['a', 'b'], 'c', 0, false);
|
||||
s2t.ok(utils.isOverflow(overflow), 'overflow object is marked');
|
||||
var merged = utils.merge(overflow, 'c');
|
||||
s2t.deepEqual(merged, { 0: 'a', 1: 'b', 2: 'c' }, 'adds primitive at next numeric index');
|
||||
var merged = utils.merge(overflow, 'd');
|
||||
s2t.deepEqual(merged, { 0: 'a', 1: 'b', 2: 'c', 3: 'd' }, 'adds primitive at next numeric index');
|
||||
s2t.end();
|
||||
});
|
||||
|
||||
@@ -93,22 +95,29 @@ test('merge()', function (t) {
|
||||
s2t.end();
|
||||
});
|
||||
|
||||
st.test('with strictMerge, wraps object and primitive in array', function (s2t) {
|
||||
var obj = { foo: 'bar' };
|
||||
var merged = utils.merge(obj, 'baz', { strictMerge: true });
|
||||
s2t.deepEqual(merged, [{ foo: 'bar' }, 'baz'], 'wraps in array with strictMerge');
|
||||
s2t.end();
|
||||
});
|
||||
|
||||
st.test('merges overflow object into primitive', function (s2t) {
|
||||
// Create an overflow object via combine
|
||||
var overflow = utils.combine([], 'b', 0, false);
|
||||
// Create an overflow object via combine: 2 elements (indices 0-1) with limit 0
|
||||
var overflow = utils.combine(['a'], 'b', 0, false);
|
||||
s2t.ok(utils.isOverflow(overflow), 'overflow object is marked');
|
||||
var merged = utils.merge('a', overflow);
|
||||
var merged = utils.merge('c', overflow);
|
||||
s2t.ok(utils.isOverflow(merged), 'result is also marked as overflow');
|
||||
s2t.deepEqual(merged, { 0: 'a', 1: 'b' }, 'creates object with primitive at 0, source values shifted');
|
||||
s2t.deepEqual(merged, { 0: 'c', 1: 'a', 2: 'b' }, 'creates object with primitive at 0, source values shifted');
|
||||
s2t.end();
|
||||
});
|
||||
|
||||
st.test('merges overflow object with multiple values into primitive', function (s2t) {
|
||||
// Create an overflow object via combine
|
||||
var overflow = utils.combine(['b'], 'c', 1, false);
|
||||
// Create an overflow object via combine: 3 elements (indices 0-2) with limit 0
|
||||
var overflow = utils.combine(['b', 'c'], 'd', 0, false);
|
||||
s2t.ok(utils.isOverflow(overflow), 'overflow object is marked');
|
||||
var merged = utils.merge('a', overflow);
|
||||
s2t.deepEqual(merged, { 0: 'a', 1: 'b', 2: 'c' }, 'shifts all source indices by 1');
|
||||
s2t.deepEqual(merged, { 0: 'a', 1: 'b', 2: 'c', 3: 'd' }, 'shifts all source indices by 1');
|
||||
s2t.end();
|
||||
});
|
||||
|
||||
@@ -196,7 +205,7 @@ test('combine()', function (t) {
|
||||
|
||||
st.test('exactly at the limit stays as array', function (s2t) {
|
||||
var combined = utils.combine(['a', 'b'], 'c', 3, false);
|
||||
s2t.deepEqual(combined, ['a', 'b', 'c'], 'stays as array when exactly at limit');
|
||||
s2t.deepEqual(combined, ['a', 'b', 'c'], 'stays as array when count equals limit');
|
||||
s2t.ok(Array.isArray(combined), 'result is an array');
|
||||
s2t.end();
|
||||
});
|
||||
@@ -208,16 +217,30 @@ test('combine()', function (t) {
|
||||
s2t.end();
|
||||
});
|
||||
|
||||
st.test('with arrayLimit 0', function (s2t) {
|
||||
st.test('with arrayLimit 1', function (s2t) {
|
||||
var combined = utils.combine([], 'a', 1, false);
|
||||
s2t.deepEqual(combined, ['a'], 'stays as array when count equals limit');
|
||||
s2t.ok(Array.isArray(combined), 'result is an array');
|
||||
s2t.end();
|
||||
});
|
||||
|
||||
st.test('with arrayLimit 0 converts single element to object', function (s2t) {
|
||||
var combined = utils.combine([], 'a', 0, false);
|
||||
s2t.deepEqual(combined, { 0: 'a' }, 'converts single element to object with arrayLimit 0');
|
||||
s2t.deepEqual(combined, { 0: 'a' }, 'converts to object when count exceeds limit');
|
||||
s2t.notOk(Array.isArray(combined), 'result is not an array');
|
||||
s2t.end();
|
||||
});
|
||||
|
||||
st.test('with arrayLimit 0 and two elements converts to object', function (s2t) {
|
||||
var combined = utils.combine(['a'], 'b', 0, false);
|
||||
s2t.deepEqual(combined, { 0: 'a', 1: 'b' }, 'converts to object when count exceeds limit');
|
||||
s2t.notOk(Array.isArray(combined), 'result is not an array');
|
||||
s2t.end();
|
||||
});
|
||||
|
||||
st.test('with plainObjects option', function (s2t) {
|
||||
var combined = utils.combine(['a'], 'b', 1, true);
|
||||
var expected = { __proto__: null, 0: 'a', 1: 'b' };
|
||||
var combined = utils.combine(['a', 'b'], 'c', 1, true);
|
||||
var expected = { __proto__: null, 0: 'a', 1: 'b', 2: 'c' };
|
||||
s2t.deepEqual(combined, expected, 'converts to object with null prototype');
|
||||
s2t.equal(Object.getPrototypeOf(combined), null, 'result has null prototype when plainObjects is true');
|
||||
s2t.end();
|
||||
@@ -228,13 +251,13 @@ test('combine()', function (t) {
|
||||
|
||||
t.test('with existing overflow object', function (st) {
|
||||
st.test('adds to existing overflow object at next index', function (s2t) {
|
||||
// Create overflow object first via combine
|
||||
var overflow = utils.combine(['a'], 'b', 1, false);
|
||||
// Create overflow object first via combine: 3 elements (indices 0-2) with limit 0
|
||||
var overflow = utils.combine(['a', 'b'], 'c', 0, false);
|
||||
s2t.ok(utils.isOverflow(overflow), 'initial object is marked as overflow');
|
||||
|
||||
var combined = utils.combine(overflow, 'c', 10, false);
|
||||
var combined = utils.combine(overflow, 'd', 10, false);
|
||||
s2t.equal(combined, overflow, 'returns the same object (mutated)');
|
||||
s2t.deepEqual(combined, { 0: 'a', 1: 'b', 2: 'c' }, 'adds value at next numeric index');
|
||||
s2t.deepEqual(combined, { 0: 'a', 1: 'b', 2: 'c', 3: 'd' }, 'adds value at next numeric index');
|
||||
s2t.end();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user