MCPcopy Index your code
hub / github.com/sequelize/sequelize-typescript / assertInstance

Function assertInstance

test/utils/common.ts:6–27  ·  view source on GitHub ↗
(instance: any | any[], expectedValues: any | any[])

Source from the content-addressed store, hash-verified

4 * Compares instance with expected values
5 */
6export function assertInstance(instance: any | any[], expectedValues: any | any[]): void {
7 if (Array.isArray(expectedValues)) {
8 expect(instance).to.have.property('length', expectedValues.length);
9
10 return instance.forEach((_instance, i) => assertInstance(_instance, expectedValues[i]));
11 }
12
13 expect(instance).to.have.property('id').that.is.not.null;
14
15 Object.keys(expectedValues).forEach((key) => {
16 const value = instance[key];
17 const expectedValue = expectedValues[key];
18
19 expect(instance).to.have.property(key).that.is.not.null.and.not.undefined;
20
21 if (typeof expectedValue === 'object') {
22 assertInstance(value, expectedValue);
23 } else {
24 expect(instance).to.have.property(key, expectedValue);
25 }
26 });
27}

Callers 4

oneToManyTestSuitesFunction · 0.90
manyToManyTestSuitesFunction · 0.90
oneToOneTestSuitesFunction · 0.90

Calls

no outgoing calls

Tested by 4

oneToManyTestSuitesFunction · 0.72
manyToManyTestSuitesFunction · 0.72
oneToOneTestSuitesFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…