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

Method assertNextCall

scripts/eval_result.ts:69–98  ·  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

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

Calls

no outgoing calls

Tested by

no test coverage detected