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

Method assertNextCall

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

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

Calls

no outgoing calls

Tested by

no test coverage detected