* Checks for deep inclusion of a provided json in a response data. * * ```js * // response.data == { data: { user: 1 } } * * I.dontSeeResponseContainsJson({ user: 2 }); * ``` * If an array is received, checks that no element of array contains json: * ```js * // response.da
(json = {})
| 202 | * @param {object} json |
| 203 | */ |
| 204 | dontSeeResponseContainsJson(json = {}) { |
| 205 | this._checkResponseReady() |
| 206 | if (Array.isArray(this.response.data)) { |
| 207 | for (const data of this.response.data) { |
| 208 | try { |
| 209 | this._assertContains(data, json) |
| 210 | assert.fail(`Found matching element: ${JSON.stringify(data)}`) |
| 211 | } catch (err) { |
| 212 | // expected to fail |
| 213 | continue |
| 214 | } |
| 215 | } |
| 216 | } else { |
| 217 | try { |
| 218 | this._assertContains(this.response.data, json) |
| 219 | assert.fail('Response contains the JSON') |
| 220 | } catch (err) { |
| 221 | // expected to fail |
| 222 | } |
| 223 | } |
| 224 | } |
| 225 | |
| 226 | /** |
| 227 | * Checks for deep inclusion of a provided json in a response data. |
no test coverage detected