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

Function ensureMock

packages/expect/src/spyMatchers.ts:1282–1297  ·  view source on GitHub ↗
(
  received: any,
  matcherName: string,
  expectedArgument: string,
  options: MatcherHintOptions,
)

Source from the content-addressed store, hash-verified

1280};
1281
1282const ensureMock = (
1283 received: any,
1284 matcherName: string,
1285 expectedArgument: string,
1286 options: MatcherHintOptions,
1287) => {
1288 if (!isMock(received)) {
1289 throw new Error(
1290 matcherErrorMessage(
1291 matcherHint(matcherName, undefined, expectedArgument, options),
1292 `${RECEIVED_COLOR('received')} value must be a mock function`,
1293 printWithType('Received', received, printReceived),
1294 ),
1295 );
1296 }
1297};
1298
1299export default spyMatchers;

Calls 4

matcherErrorMessageFunction · 0.90
matcherHintFunction · 0.90
printWithTypeFunction · 0.90
isMockFunction · 0.85

Tested by

no test coverage detected