MCPcopy
hub / github.com/jestjs/jest / printReceivedConstructorNameNot

Function printReceivedConstructorNameNot

packages/expect/src/print.ts:104–118  ·  view source on GitHub ↗
(
  label: string,
  received: Function,
  expected: Function,
)

Source from the content-addressed store, hash-verified

102
103// Do not call function if received is equal to expected.
104export const printReceivedConstructorNameNot = (
105 label: string,
106 received: Function,
107 expected: Function,
108): string =>
109 typeof expected.name === 'string' &&
110 expected.name.length > 0 &&
111 typeof received.name === 'string' &&
112 received.name.length > 0
113 ? `${printConstructorName(label, received, true, false)} ${
114 Object.getPrototypeOf(received) === expected
115 ? 'extends'
116 : 'extends … extends'
117 } ${EXPECTED_COLOR(expected.name)}\n`
118 : `${printConstructorName(label, received, false, false)}\n`;
119
120const printConstructorName = (
121 label: string,

Callers 2

toBeInstanceOfFunction · 0.90
toThrowExpectedClassFunction · 0.90

Calls 1

printConstructorNameFunction · 0.85

Tested by

no test coverage detected