MCPcopy Create free account
hub / github.com/denoland/std / assertSpyCallArg

Function assertSpyCallArg

testing/mock.ts:1459–1474  ·  view source on GitHub ↗
(
  spy: SpyLike<Self, Args, Return>,
  callIndex: number,
  argIndex: number,
  expected: ExpectedArg,
)

Source from the content-addressed store, hash-verified

1457 * @returns The actual argument.
1458 */
1459export function assertSpyCallArg<
1460 Self,
1461 Args extends unknown[],
1462 Return,
1463 ExpectedArg,
1464>(
1465 spy: SpyLike<Self, Args, Return>,
1466 callIndex: number,
1467 argIndex: number,
1468 expected: ExpectedArg,
1469): ExpectedArg {
1470 const call = getSpyCall(spy, callIndex);
1471 const arg = call?.args[argIndex];
1472 assertEquals(arg, expected);
1473 return arg as ExpectedArg;
1474}
1475
1476/**
1477 * Asserts that an spy is called with a specific range of args as expected.

Callers 2

mock_test.tsFile · 0.90

Calls 2

assertEqualsFunction · 0.90
getSpyCallFunction · 0.85

Tested by

no test coverage detected