MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / seeResponseValidByCallback

Method seeResponseValidByCallback

lib/helper/JSONResponse.js:274–279  ·  view source on GitHub ↗

* Executes a callback function passing in `response` object and assert * Use it to perform custom checks of response data * * ```js * I.seeResponseValidByCallback(({ data, status }) => { * assert.strictEqual(status, 200); * assert('user' in data); * assert('company' in dat

(fn)

Source from the content-addressed store, hash-verified

272 * @param {function} fn
273 */
274 seeResponseValidByCallback(fn) {
275 this._checkResponseReady()
276 fn({ ...this.response, assert })
277 const body = fn.toString()
278 fn.toString = () => `${body.split('\n')[1]}...`
279 }
280
281 /**
282 * Checks that response data equals to expected:

Callers 1

Calls 3

_checkResponseReadyMethod · 0.95
fnFunction · 0.50
toStringMethod · 0.45

Tested by

no test coverage detected