mirror of
https://github.com/xfarrow/blink
synced 2025-06-27 09:03:02 +02:00
Change endpoint from persons to people
This commit is contained in:
21
backend/apis/nodejs/node_modules/@jest/expect-utils/LICENSE
generated
vendored
Normal file
21
backend/apis/nodejs/node_modules/@jest/expect-utils/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
5
backend/apis/nodejs/node_modules/@jest/expect-utils/README.md
generated
vendored
Normal file
5
backend/apis/nodejs/node_modules/@jest/expect-utils/README.md
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
# `@jest/expect-utils`
|
||||
|
||||
This module exports some utils for the `expect` function used in [Jest](https://jestjs.io/).
|
||||
|
||||
You probably don't want to use this package directly. E.g. if you're writing [custom matcher](https://jestjs.io/docs/expect#expectextendmatchers), you should use the injected [`this.equals`](https://jestjs.io/docs/expect#thisequalsa-b).
|
66
backend/apis/nodejs/node_modules/@jest/expect-utils/build/immutableUtils.js
generated
vendored
Normal file
66
backend/apis/nodejs/node_modules/@jest/expect-utils/build/immutableUtils.js
generated
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.isImmutableList = isImmutableList;
|
||||
exports.isImmutableOrderedKeyed = isImmutableOrderedKeyed;
|
||||
exports.isImmutableOrderedSet = isImmutableOrderedSet;
|
||||
exports.isImmutableRecord = isImmutableRecord;
|
||||
exports.isImmutableUnorderedKeyed = isImmutableUnorderedKeyed;
|
||||
exports.isImmutableUnorderedSet = isImmutableUnorderedSet;
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
|
||||
// SENTINEL constants are from https://github.com/immutable-js/immutable-js/tree/main/src/predicates
|
||||
const IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';
|
||||
const IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';
|
||||
const IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@';
|
||||
const IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';
|
||||
const IS_RECORD_SYMBOL = '@@__IMMUTABLE_RECORD__@@';
|
||||
function isObjectLiteral(source) {
|
||||
return source != null && typeof source === 'object' && !Array.isArray(source);
|
||||
}
|
||||
function isImmutableUnorderedKeyed(source) {
|
||||
return Boolean(
|
||||
source &&
|
||||
isObjectLiteral(source) &&
|
||||
source[IS_KEYED_SENTINEL] &&
|
||||
!source[IS_ORDERED_SENTINEL]
|
||||
);
|
||||
}
|
||||
function isImmutableUnorderedSet(source) {
|
||||
return Boolean(
|
||||
source &&
|
||||
isObjectLiteral(source) &&
|
||||
source[IS_SET_SENTINEL] &&
|
||||
!source[IS_ORDERED_SENTINEL]
|
||||
);
|
||||
}
|
||||
function isImmutableList(source) {
|
||||
return Boolean(source && isObjectLiteral(source) && source[IS_LIST_SENTINEL]);
|
||||
}
|
||||
function isImmutableOrderedKeyed(source) {
|
||||
return Boolean(
|
||||
source &&
|
||||
isObjectLiteral(source) &&
|
||||
source[IS_KEYED_SENTINEL] &&
|
||||
source[IS_ORDERED_SENTINEL]
|
||||
);
|
||||
}
|
||||
function isImmutableOrderedSet(source) {
|
||||
return Boolean(
|
||||
source &&
|
||||
isObjectLiteral(source) &&
|
||||
source[IS_SET_SENTINEL] &&
|
||||
source[IS_ORDERED_SENTINEL]
|
||||
);
|
||||
}
|
||||
function isImmutableRecord(source) {
|
||||
return Boolean(source && isObjectLiteral(source) && source[IS_RECORD_SYMBOL]);
|
||||
}
|
94
backend/apis/nodejs/node_modules/@jest/expect-utils/build/index.d.ts
generated
vendored
Normal file
94
backend/apis/nodejs/node_modules/@jest/expect-utils/build/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,94 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
export declare const arrayBufferEquality: (
|
||||
a: unknown,
|
||||
b: unknown,
|
||||
) => boolean | undefined;
|
||||
|
||||
export declare function emptyObject(obj: unknown): boolean;
|
||||
|
||||
export declare const equals: EqualsFunction;
|
||||
|
||||
export declare type EqualsFunction = (
|
||||
a: unknown,
|
||||
b: unknown,
|
||||
customTesters?: Array<Tester>,
|
||||
strictCheck?: boolean,
|
||||
) => boolean;
|
||||
|
||||
export declare const getObjectKeys: (object: object) => Array<string | symbol>;
|
||||
|
||||
export declare const getObjectSubset: (
|
||||
object: any,
|
||||
subset: any,
|
||||
customTesters?: Array<Tester>,
|
||||
seenReferences?: WeakMap<object, boolean>,
|
||||
) => any;
|
||||
|
||||
declare type GetPath = {
|
||||
hasEndProp?: boolean;
|
||||
endPropIsDefined?: boolean;
|
||||
lastTraversedObject: unknown;
|
||||
traversedPath: Array<string>;
|
||||
value?: unknown;
|
||||
};
|
||||
|
||||
export declare const getPath: (
|
||||
object: Record<string, any>,
|
||||
propertyPath: string | Array<string>,
|
||||
) => GetPath;
|
||||
|
||||
export declare function isA<T>(typeName: string, value: unknown): value is T;
|
||||
|
||||
export declare const isError: (value: unknown) => value is Error;
|
||||
|
||||
export declare const isOneline: (
|
||||
expected: unknown,
|
||||
received: unknown,
|
||||
) => boolean;
|
||||
|
||||
export declare const iterableEquality: (
|
||||
a: any,
|
||||
b: any,
|
||||
customTesters?: Array<Tester>,
|
||||
aStack?: Array<any>,
|
||||
bStack?: Array<any>,
|
||||
) => boolean | undefined;
|
||||
|
||||
export declare const partition: <T>(
|
||||
items: T[],
|
||||
predicate: (arg: T) => boolean,
|
||||
) => [T[], T[]];
|
||||
|
||||
export declare const pathAsArray: (propertyPath: string) => Array<any>;
|
||||
|
||||
export declare const sparseArrayEquality: (
|
||||
a: unknown,
|
||||
b: unknown,
|
||||
customTesters?: Array<Tester>,
|
||||
) => boolean | undefined;
|
||||
|
||||
export declare const subsetEquality: (
|
||||
object: unknown,
|
||||
subset: unknown,
|
||||
customTesters?: Array<Tester>,
|
||||
) => boolean | undefined;
|
||||
|
||||
export declare type Tester = (
|
||||
this: TesterContext,
|
||||
a: any,
|
||||
b: any,
|
||||
customTesters: Array<Tester>,
|
||||
) => boolean | undefined;
|
||||
|
||||
export declare interface TesterContext {
|
||||
equals: EqualsFunction;
|
||||
}
|
||||
|
||||
export declare const typeEquality: (a: any, b: any) => boolean | undefined;
|
||||
|
||||
export {};
|
34
backend/apis/nodejs/node_modules/@jest/expect-utils/build/index.js
generated
vendored
Normal file
34
backend/apis/nodejs/node_modules/@jest/expect-utils/build/index.js
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
var _exportNames = {
|
||||
equals: true,
|
||||
isA: true
|
||||
};
|
||||
Object.defineProperty(exports, 'equals', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _jasmineUtils.equals;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'isA', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _jasmineUtils.isA;
|
||||
}
|
||||
});
|
||||
var _jasmineUtils = require('./jasmineUtils');
|
||||
var _utils = require('./utils');
|
||||
Object.keys(_utils).forEach(function (key) {
|
||||
if (key === 'default' || key === '__esModule') return;
|
||||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
||||
if (key in exports && exports[key] === _utils[key]) return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _utils[key];
|
||||
}
|
||||
});
|
||||
});
|
218
backend/apis/nodejs/node_modules/@jest/expect-utils/build/jasmineUtils.js
generated
vendored
Normal file
218
backend/apis/nodejs/node_modules/@jest/expect-utils/build/jasmineUtils.js
generated
vendored
Normal file
@ -0,0 +1,218 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.equals = void 0;
|
||||
exports.isA = isA;
|
||||
/*
|
||||
Copyright (c) 2008-2016 Pivotal Labs
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
// Extracted out of jasmine 2.5.2
|
||||
const equals = (a, b, customTesters, strictCheck) => {
|
||||
customTesters = customTesters || [];
|
||||
return eq(a, b, [], [], customTesters, strictCheck);
|
||||
};
|
||||
exports.equals = equals;
|
||||
function isAsymmetric(obj) {
|
||||
return !!obj && isA('Function', obj.asymmetricMatch);
|
||||
}
|
||||
function asymmetricMatch(a, b) {
|
||||
const asymmetricA = isAsymmetric(a);
|
||||
const asymmetricB = isAsymmetric(b);
|
||||
if (asymmetricA && asymmetricB) {
|
||||
return undefined;
|
||||
}
|
||||
if (asymmetricA) {
|
||||
return a.asymmetricMatch(b);
|
||||
}
|
||||
if (asymmetricB) {
|
||||
return b.asymmetricMatch(a);
|
||||
}
|
||||
}
|
||||
|
||||
// Equality function lovingly adapted from isEqual in
|
||||
// [Underscore](http://underscorejs.org)
|
||||
function eq(a, b, aStack, bStack, customTesters, strictCheck) {
|
||||
let result = true;
|
||||
const asymmetricResult = asymmetricMatch(a, b);
|
||||
if (asymmetricResult !== undefined) {
|
||||
return asymmetricResult;
|
||||
}
|
||||
const testerContext = {
|
||||
equals
|
||||
};
|
||||
for (let i = 0; i < customTesters.length; i++) {
|
||||
const customTesterResult = customTesters[i].call(
|
||||
testerContext,
|
||||
a,
|
||||
b,
|
||||
customTesters
|
||||
);
|
||||
if (customTesterResult !== undefined) {
|
||||
return customTesterResult;
|
||||
}
|
||||
}
|
||||
if (a instanceof Error && b instanceof Error) {
|
||||
return a.message == b.message;
|
||||
}
|
||||
if (Object.is(a, b)) {
|
||||
return true;
|
||||
}
|
||||
// A strict comparison is necessary because `null == undefined`.
|
||||
if (a === null || b === null) {
|
||||
return a === b;
|
||||
}
|
||||
const className = Object.prototype.toString.call(a);
|
||||
if (className != Object.prototype.toString.call(b)) {
|
||||
return false;
|
||||
}
|
||||
switch (className) {
|
||||
case '[object Boolean]':
|
||||
case '[object String]':
|
||||
case '[object Number]':
|
||||
if (typeof a !== typeof b) {
|
||||
// One is a primitive, one a `new Primitive()`
|
||||
return false;
|
||||
} else if (typeof a !== 'object' && typeof b !== 'object') {
|
||||
// both are proper primitives
|
||||
return Object.is(a, b);
|
||||
} else {
|
||||
// both are `new Primitive()`s
|
||||
return Object.is(a.valueOf(), b.valueOf());
|
||||
}
|
||||
case '[object Date]':
|
||||
// Coerce dates to numeric primitive values. Dates are compared by their
|
||||
// millisecond representations. Note that invalid dates with millisecond representations
|
||||
// of `NaN` are not equivalent.
|
||||
return +a == +b;
|
||||
// RegExps are compared by their source patterns and flags.
|
||||
case '[object RegExp]':
|
||||
return a.source === b.source && a.flags === b.flags;
|
||||
}
|
||||
if (typeof a !== 'object' || typeof b !== 'object') {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Use DOM3 method isEqualNode (IE>=9)
|
||||
if (isDomNode(a) && isDomNode(b)) {
|
||||
return a.isEqualNode(b);
|
||||
}
|
||||
|
||||
// Used to detect circular references.
|
||||
let length = aStack.length;
|
||||
while (length--) {
|
||||
// Linear search. Performance is inversely proportional to the number of
|
||||
// unique nested structures.
|
||||
// circular references at same depth are equal
|
||||
// circular reference is not equal to non-circular one
|
||||
if (aStack[length] === a) {
|
||||
return bStack[length] === b;
|
||||
} else if (bStack[length] === b) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Add the first object to the stack of traversed objects.
|
||||
aStack.push(a);
|
||||
bStack.push(b);
|
||||
// Recursively compare objects and arrays.
|
||||
// Compare array lengths to determine if a deep comparison is necessary.
|
||||
if (strictCheck && className == '[object Array]' && a.length !== b.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Deep compare objects.
|
||||
const aKeys = keys(a, hasKey);
|
||||
let key;
|
||||
const bKeys = keys(b, hasKey);
|
||||
// Add keys corresponding to asymmetric matchers if they miss in non strict check mode
|
||||
if (!strictCheck) {
|
||||
for (let index = 0; index !== bKeys.length; ++index) {
|
||||
key = bKeys[index];
|
||||
if ((isAsymmetric(b[key]) || b[key] === undefined) && !hasKey(a, key)) {
|
||||
aKeys.push(key);
|
||||
}
|
||||
}
|
||||
for (let index = 0; index !== aKeys.length; ++index) {
|
||||
key = aKeys[index];
|
||||
if ((isAsymmetric(a[key]) || a[key] === undefined) && !hasKey(b, key)) {
|
||||
bKeys.push(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure that both objects contain the same number of properties before comparing deep equality.
|
||||
let size = aKeys.length;
|
||||
if (bKeys.length !== size) {
|
||||
return false;
|
||||
}
|
||||
while (size--) {
|
||||
key = aKeys[size];
|
||||
|
||||
// Deep compare each member
|
||||
if (strictCheck)
|
||||
result =
|
||||
hasKey(b, key) &&
|
||||
eq(a[key], b[key], aStack, bStack, customTesters, strictCheck);
|
||||
else
|
||||
result =
|
||||
(hasKey(b, key) || isAsymmetric(a[key]) || a[key] === undefined) &&
|
||||
eq(a[key], b[key], aStack, bStack, customTesters, strictCheck);
|
||||
if (!result) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Remove the first object from the stack of traversed objects.
|
||||
aStack.pop();
|
||||
bStack.pop();
|
||||
return result;
|
||||
}
|
||||
function keys(obj, hasKey) {
|
||||
const keys = [];
|
||||
for (const key in obj) {
|
||||
if (hasKey(obj, key)) {
|
||||
keys.push(key);
|
||||
}
|
||||
}
|
||||
return keys.concat(
|
||||
Object.getOwnPropertySymbols(obj).filter(
|
||||
symbol => Object.getOwnPropertyDescriptor(obj, symbol).enumerable
|
||||
)
|
||||
);
|
||||
}
|
||||
function hasKey(obj, key) {
|
||||
return Object.prototype.hasOwnProperty.call(obj, key);
|
||||
}
|
||||
function isA(typeName, value) {
|
||||
return Object.prototype.toString.apply(value) === `[object ${typeName}]`;
|
||||
}
|
||||
function isDomNode(obj) {
|
||||
return (
|
||||
obj !== null &&
|
||||
typeof obj === 'object' &&
|
||||
typeof obj.nodeType === 'number' &&
|
||||
typeof obj.nodeName === 'string' &&
|
||||
typeof obj.isEqualNode === 'function'
|
||||
);
|
||||
}
|
1
backend/apis/nodejs/node_modules/@jest/expect-utils/build/types.js
generated
vendored
Normal file
1
backend/apis/nodejs/node_modules/@jest/expect-utils/build/types.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
'use strict';
|
462
backend/apis/nodejs/node_modules/@jest/expect-utils/build/utils.js
generated
vendored
Normal file
462
backend/apis/nodejs/node_modules/@jest/expect-utils/build/utils.js
generated
vendored
Normal file
@ -0,0 +1,462 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.arrayBufferEquality = void 0;
|
||||
exports.emptyObject = emptyObject;
|
||||
exports.typeEquality =
|
||||
exports.subsetEquality =
|
||||
exports.sparseArrayEquality =
|
||||
exports.pathAsArray =
|
||||
exports.partition =
|
||||
exports.iterableEquality =
|
||||
exports.isOneline =
|
||||
exports.isError =
|
||||
exports.getPath =
|
||||
exports.getObjectSubset =
|
||||
exports.getObjectKeys =
|
||||
void 0;
|
||||
var _jestGetType = require('jest-get-type');
|
||||
var _immutableUtils = require('./immutableUtils');
|
||||
var _jasmineUtils = require('./jasmineUtils');
|
||||
var Symbol = globalThis['jest-symbol-do-not-touch'] || globalThis.Symbol;
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* Checks if `hasOwnProperty(object, key)` up the prototype chain, stopping at `Object.prototype`.
|
||||
*/
|
||||
const hasPropertyInObject = (object, key) => {
|
||||
const shouldTerminate =
|
||||
!object || typeof object !== 'object' || object === Object.prototype;
|
||||
if (shouldTerminate) {
|
||||
return false;
|
||||
}
|
||||
return (
|
||||
Object.prototype.hasOwnProperty.call(object, key) ||
|
||||
hasPropertyInObject(Object.getPrototypeOf(object), key)
|
||||
);
|
||||
};
|
||||
|
||||
// Retrieves an object's keys for evaluation by getObjectSubset. This evaluates
|
||||
// the prototype chain for string keys but not for symbols. (Otherwise, it
|
||||
// could find values such as a Set or Map's Symbol.toStringTag, with unexpected
|
||||
// results.)
|
||||
const getObjectKeys = object => [
|
||||
...Object.keys(object),
|
||||
...Object.getOwnPropertySymbols(object)
|
||||
];
|
||||
exports.getObjectKeys = getObjectKeys;
|
||||
const getPath = (object, propertyPath) => {
|
||||
if (!Array.isArray(propertyPath)) {
|
||||
propertyPath = pathAsArray(propertyPath);
|
||||
}
|
||||
if (propertyPath.length) {
|
||||
const lastProp = propertyPath.length === 1;
|
||||
const prop = propertyPath[0];
|
||||
const newObject = object[prop];
|
||||
if (!lastProp && (newObject === null || newObject === undefined)) {
|
||||
// This is not the last prop in the chain. If we keep recursing it will
|
||||
// hit a `can't access property X of undefined | null`. At this point we
|
||||
// know that the chain has broken and we can return right away.
|
||||
return {
|
||||
hasEndProp: false,
|
||||
lastTraversedObject: object,
|
||||
traversedPath: []
|
||||
};
|
||||
}
|
||||
const result = getPath(newObject, propertyPath.slice(1));
|
||||
if (result.lastTraversedObject === null) {
|
||||
result.lastTraversedObject = object;
|
||||
}
|
||||
result.traversedPath.unshift(prop);
|
||||
if (lastProp) {
|
||||
// Does object have the property with an undefined value?
|
||||
// Although primitive values support bracket notation (above)
|
||||
// they would throw TypeError for in operator (below).
|
||||
result.endPropIsDefined =
|
||||
!(0, _jestGetType.isPrimitive)(object) && prop in object;
|
||||
result.hasEndProp = newObject !== undefined || result.endPropIsDefined;
|
||||
if (!result.hasEndProp) {
|
||||
result.traversedPath.shift();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return {
|
||||
lastTraversedObject: null,
|
||||
traversedPath: [],
|
||||
value: object
|
||||
};
|
||||
};
|
||||
|
||||
// Strip properties from object that are not present in the subset. Useful for
|
||||
// printing the diff for toMatchObject() without adding unrelated noise.
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
exports.getPath = getPath;
|
||||
const getObjectSubset = (
|
||||
object,
|
||||
subset,
|
||||
customTesters = [],
|
||||
seenReferences = new WeakMap()
|
||||
) => {
|
||||
/* eslint-enable @typescript-eslint/explicit-module-boundary-types */
|
||||
if (Array.isArray(object)) {
|
||||
if (Array.isArray(subset) && subset.length === object.length) {
|
||||
// The map method returns correct subclass of subset.
|
||||
return subset.map((sub, i) =>
|
||||
getObjectSubset(object[i], sub, customTesters)
|
||||
);
|
||||
}
|
||||
} else if (object instanceof Date) {
|
||||
return object;
|
||||
} else if (isObject(object) && isObject(subset)) {
|
||||
if (
|
||||
(0, _jasmineUtils.equals)(object, subset, [
|
||||
...customTesters,
|
||||
iterableEquality,
|
||||
subsetEquality
|
||||
])
|
||||
) {
|
||||
// Avoid unnecessary copy which might return Object instead of subclass.
|
||||
return subset;
|
||||
}
|
||||
const trimmed = {};
|
||||
seenReferences.set(object, trimmed);
|
||||
getObjectKeys(object)
|
||||
.filter(key => hasPropertyInObject(subset, key))
|
||||
.forEach(key => {
|
||||
trimmed[key] = seenReferences.has(object[key])
|
||||
? seenReferences.get(object[key])
|
||||
: getObjectSubset(
|
||||
object[key],
|
||||
subset[key],
|
||||
customTesters,
|
||||
seenReferences
|
||||
);
|
||||
});
|
||||
if (getObjectKeys(trimmed).length > 0) {
|
||||
return trimmed;
|
||||
}
|
||||
}
|
||||
return object;
|
||||
};
|
||||
exports.getObjectSubset = getObjectSubset;
|
||||
const IteratorSymbol = Symbol.iterator;
|
||||
const hasIterator = object => !!(object != null && object[IteratorSymbol]);
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
const iterableEquality = (
|
||||
a,
|
||||
b,
|
||||
customTesters = [] /* eslint-enable @typescript-eslint/explicit-module-boundary-types */,
|
||||
aStack = [],
|
||||
bStack = []
|
||||
) => {
|
||||
if (
|
||||
typeof a !== 'object' ||
|
||||
typeof b !== 'object' ||
|
||||
Array.isArray(a) ||
|
||||
Array.isArray(b) ||
|
||||
!hasIterator(a) ||
|
||||
!hasIterator(b)
|
||||
) {
|
||||
return undefined;
|
||||
}
|
||||
if (a.constructor !== b.constructor) {
|
||||
return false;
|
||||
}
|
||||
let length = aStack.length;
|
||||
while (length--) {
|
||||
// Linear search. Performance is inversely proportional to the number of
|
||||
// unique nested structures.
|
||||
// circular references at same depth are equal
|
||||
// circular reference is not equal to non-circular one
|
||||
if (aStack[length] === a) {
|
||||
return bStack[length] === b;
|
||||
}
|
||||
}
|
||||
aStack.push(a);
|
||||
bStack.push(b);
|
||||
const iterableEqualityWithStack = (a, b) =>
|
||||
iterableEquality(
|
||||
a,
|
||||
b,
|
||||
[...filteredCustomTesters],
|
||||
[...aStack],
|
||||
[...bStack]
|
||||
);
|
||||
|
||||
// Replace any instance of iterableEquality with the new
|
||||
// iterableEqualityWithStack so we can do circular detection
|
||||
const filteredCustomTesters = [
|
||||
...customTesters.filter(t => t !== iterableEquality),
|
||||
iterableEqualityWithStack
|
||||
];
|
||||
if (a.size !== undefined) {
|
||||
if (a.size !== b.size) {
|
||||
return false;
|
||||
} else if (
|
||||
(0, _jasmineUtils.isA)('Set', a) ||
|
||||
(0, _immutableUtils.isImmutableUnorderedSet)(a)
|
||||
) {
|
||||
let allFound = true;
|
||||
for (const aValue of a) {
|
||||
if (!b.has(aValue)) {
|
||||
let has = false;
|
||||
for (const bValue of b) {
|
||||
const isEqual = (0, _jasmineUtils.equals)(
|
||||
aValue,
|
||||
bValue,
|
||||
filteredCustomTesters
|
||||
);
|
||||
if (isEqual === true) {
|
||||
has = true;
|
||||
}
|
||||
}
|
||||
if (has === false) {
|
||||
allFound = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Remove the first value from the stack of traversed values.
|
||||
aStack.pop();
|
||||
bStack.pop();
|
||||
return allFound;
|
||||
} else if (
|
||||
(0, _jasmineUtils.isA)('Map', a) ||
|
||||
(0, _immutableUtils.isImmutableUnorderedKeyed)(a)
|
||||
) {
|
||||
let allFound = true;
|
||||
for (const aEntry of a) {
|
||||
if (
|
||||
!b.has(aEntry[0]) ||
|
||||
!(0, _jasmineUtils.equals)(
|
||||
aEntry[1],
|
||||
b.get(aEntry[0]),
|
||||
filteredCustomTesters
|
||||
)
|
||||
) {
|
||||
let has = false;
|
||||
for (const bEntry of b) {
|
||||
const matchedKey = (0, _jasmineUtils.equals)(
|
||||
aEntry[0],
|
||||
bEntry[0],
|
||||
filteredCustomTesters
|
||||
);
|
||||
let matchedValue = false;
|
||||
if (matchedKey === true) {
|
||||
matchedValue = (0, _jasmineUtils.equals)(
|
||||
aEntry[1],
|
||||
bEntry[1],
|
||||
filteredCustomTesters
|
||||
);
|
||||
}
|
||||
if (matchedValue === true) {
|
||||
has = true;
|
||||
}
|
||||
}
|
||||
if (has === false) {
|
||||
allFound = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Remove the first value from the stack of traversed values.
|
||||
aStack.pop();
|
||||
bStack.pop();
|
||||
return allFound;
|
||||
}
|
||||
}
|
||||
const bIterator = b[IteratorSymbol]();
|
||||
for (const aValue of a) {
|
||||
const nextB = bIterator.next();
|
||||
if (
|
||||
nextB.done ||
|
||||
!(0, _jasmineUtils.equals)(aValue, nextB.value, filteredCustomTesters)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!bIterator.next().done) {
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
!(0, _immutableUtils.isImmutableList)(a) &&
|
||||
!(0, _immutableUtils.isImmutableOrderedKeyed)(a) &&
|
||||
!(0, _immutableUtils.isImmutableOrderedSet)(a) &&
|
||||
!(0, _immutableUtils.isImmutableRecord)(a)
|
||||
) {
|
||||
const aEntries = Object.entries(a);
|
||||
const bEntries = Object.entries(b);
|
||||
if (!(0, _jasmineUtils.equals)(aEntries, bEntries)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the first value from the stack of traversed values.
|
||||
aStack.pop();
|
||||
bStack.pop();
|
||||
return true;
|
||||
};
|
||||
exports.iterableEquality = iterableEquality;
|
||||
const isObject = a => a !== null && typeof a === 'object';
|
||||
const isObjectWithKeys = a =>
|
||||
isObject(a) &&
|
||||
!(a instanceof Error) &&
|
||||
!(a instanceof Array) &&
|
||||
!(a instanceof Date);
|
||||
const subsetEquality = (object, subset, customTesters = []) => {
|
||||
const filteredCustomTesters = customTesters.filter(t => t !== subsetEquality);
|
||||
|
||||
// subsetEquality needs to keep track of the references
|
||||
// it has already visited to avoid infinite loops in case
|
||||
// there are circular references in the subset passed to it.
|
||||
const subsetEqualityWithContext =
|
||||
(seenReferences = new WeakMap()) =>
|
||||
(object, subset) => {
|
||||
if (!isObjectWithKeys(subset)) {
|
||||
return undefined;
|
||||
}
|
||||
return getObjectKeys(subset).every(key => {
|
||||
if (isObjectWithKeys(subset[key])) {
|
||||
if (seenReferences.has(subset[key])) {
|
||||
return (0, _jasmineUtils.equals)(
|
||||
object[key],
|
||||
subset[key],
|
||||
filteredCustomTesters
|
||||
);
|
||||
}
|
||||
seenReferences.set(subset[key], true);
|
||||
}
|
||||
const result =
|
||||
object != null &&
|
||||
hasPropertyInObject(object, key) &&
|
||||
(0, _jasmineUtils.equals)(object[key], subset[key], [
|
||||
...filteredCustomTesters,
|
||||
subsetEqualityWithContext(seenReferences)
|
||||
]);
|
||||
// The main goal of using seenReference is to avoid circular node on tree.
|
||||
// It will only happen within a parent and its child, not a node and nodes next to it (same level)
|
||||
// We should keep the reference for a parent and its child only
|
||||
// Thus we should delete the reference immediately so that it doesn't interfere
|
||||
// other nodes within the same level on tree.
|
||||
seenReferences.delete(subset[key]);
|
||||
return result;
|
||||
});
|
||||
};
|
||||
return subsetEqualityWithContext()(object, subset);
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
exports.subsetEquality = subsetEquality;
|
||||
const typeEquality = (a, b) => {
|
||||
if (
|
||||
a == null ||
|
||||
b == null ||
|
||||
a.constructor === b.constructor ||
|
||||
// Since Jest globals are different from Node globals,
|
||||
// constructors are different even between arrays when comparing properties of mock objects.
|
||||
// Both of them should be able to compare correctly when they are array-to-array.
|
||||
// https://github.com/jestjs/jest/issues/2549
|
||||
(Array.isArray(a) && Array.isArray(b))
|
||||
) {
|
||||
return undefined;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
exports.typeEquality = typeEquality;
|
||||
const arrayBufferEquality = (a, b) => {
|
||||
if (!(a instanceof ArrayBuffer) || !(b instanceof ArrayBuffer)) {
|
||||
return undefined;
|
||||
}
|
||||
const dataViewA = new DataView(a);
|
||||
const dataViewB = new DataView(b);
|
||||
|
||||
// Buffers are not equal when they do not have the same byte length
|
||||
if (dataViewA.byteLength !== dataViewB.byteLength) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if every byte value is equal to each other
|
||||
for (let i = 0; i < dataViewA.byteLength; i++) {
|
||||
if (dataViewA.getUint8(i) !== dataViewB.getUint8(i)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
exports.arrayBufferEquality = arrayBufferEquality;
|
||||
const sparseArrayEquality = (a, b, customTesters = []) => {
|
||||
if (!Array.isArray(a) || !Array.isArray(b)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// A sparse array [, , 1] will have keys ["2"] whereas [undefined, undefined, 1] will have keys ["0", "1", "2"]
|
||||
const aKeys = Object.keys(a);
|
||||
const bKeys = Object.keys(b);
|
||||
return (
|
||||
(0, _jasmineUtils.equals)(
|
||||
a,
|
||||
b,
|
||||
customTesters.filter(t => t !== sparseArrayEquality),
|
||||
true
|
||||
) && (0, _jasmineUtils.equals)(aKeys, bKeys)
|
||||
);
|
||||
};
|
||||
exports.sparseArrayEquality = sparseArrayEquality;
|
||||
const partition = (items, predicate) => {
|
||||
const result = [[], []];
|
||||
items.forEach(item => result[predicate(item) ? 0 : 1].push(item));
|
||||
return result;
|
||||
};
|
||||
exports.partition = partition;
|
||||
const pathAsArray = propertyPath => {
|
||||
const properties = [];
|
||||
if (propertyPath === '') {
|
||||
properties.push('');
|
||||
return properties;
|
||||
}
|
||||
|
||||
// will match everything that's not a dot or a bracket, and "" for consecutive dots.
|
||||
const pattern = RegExp('[^.[\\]]+|(?=(?:\\.)(?:\\.|$))', 'g');
|
||||
|
||||
// Because the regex won't match a dot in the beginning of the path, if present.
|
||||
if (propertyPath[0] === '.') {
|
||||
properties.push('');
|
||||
}
|
||||
propertyPath.replace(pattern, match => {
|
||||
properties.push(match);
|
||||
return match;
|
||||
});
|
||||
return properties;
|
||||
};
|
||||
|
||||
// Copied from https://github.com/graingert/angular.js/blob/a43574052e9775cbc1d7dd8a086752c979b0f020/src/Angular.js#L685-L693
|
||||
exports.pathAsArray = pathAsArray;
|
||||
const isError = value => {
|
||||
switch (Object.prototype.toString.call(value)) {
|
||||
case '[object Error]':
|
||||
case '[object Exception]':
|
||||
case '[object DOMException]':
|
||||
return true;
|
||||
default:
|
||||
return value instanceof Error;
|
||||
}
|
||||
};
|
||||
exports.isError = isError;
|
||||
function emptyObject(obj) {
|
||||
return obj && typeof obj === 'object' ? !Object.keys(obj).length : false;
|
||||
}
|
||||
const MULTILINE_REGEXP = /[\r\n]/;
|
||||
const isOneline = (expected, received) =>
|
||||
typeof expected === 'string' &&
|
||||
typeof received === 'string' &&
|
||||
(!MULTILINE_REGEXP.test(expected) || !MULTILINE_REGEXP.test(received));
|
||||
exports.isOneline = isOneline;
|
35
backend/apis/nodejs/node_modules/@jest/expect-utils/package.json
generated
vendored
Normal file
35
backend/apis/nodejs/node_modules/@jest/expect-utils/package.json
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "@jest/expect-utils",
|
||||
"version": "29.7.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jestjs/jest.git",
|
||||
"directory": "packages/expect-utils"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "./build/index.js",
|
||||
"types": "./build/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./build/index.d.ts",
|
||||
"default": "./build/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"jest-get-type": "^29.6.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tsd/typescript": "^5.0.4",
|
||||
"immutable": "^4.0.0",
|
||||
"jest-matcher-utils": "^29.7.0",
|
||||
"tsd-lite": "^0.7.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "4e56991693da7cd4c3730dc3579a1dd1403ee630"
|
||||
}
|
Reference in New Issue
Block a user