MCPcopy Create free account
hub / github.com/ChromeDevTools/chrome-devtools-mcp / assertNextCall

Method assertNextCall

scripts/eval_result.ts:65–94  ·  view source on GitHub ↗

* Asserts that the next call in sequence has the correct name and matches expected arguments. * Increments the internal call index.

(
    name: string,
    expectedArgs?: Record<string, unknown>,
  )

Source from the content-addressed store, hash-verified

63 * Increments the internal call index.
64 */
65 assertNextCall(
66 name: string,
67 expectedArgs?: Record<string, unknown>,
68 ): CapturedFunctionCall {
69 const call = this.calls[this.nextCallIndex];
70 assert.ok(
71 call,
72 `Expected call at index ${this.nextCallIndex} (name: '${name}') to exist`,
73 );
74 assert.strictEqual(
75 call.name,
76 name,
77 `Expected call at index ${this.nextCallIndex} to be '${name}', but got '${call.name}'`,
78 );
79
80 if (expectedArgs) {
81 for (const entry of Object.entries(expectedArgs)) {
82 const key = entry[0];
83 const value = entry[1];
84 assert.deepStrictEqual(
85 call.args[key],
86 value,
87 `Expected argument '${key}' on call '${name}' to be ${JSON.stringify(value)}, got ${JSON.stringify(call.args[key])}`,
88 );
89 }
90 }
91
92 this.nextCallIndex++;
93 return call;
94 }
95}
96
97export interface TestScenario {

Calls

no outgoing calls

Tested by

no test coverage detected