UNPKG

@opra/testing

Version:
25 lines (24 loc) 789 B
import '../expect-extend/index.js'; import { ApiExpectBase } from './api-expect-base.js'; export class ApiExpectOperationResult extends ApiExpectBase { get not() { return new ApiExpectOperationResult(this.response, !this.isNot); } toBeAffected(min, max) { let msg = ''; try { msg += `The value of "affected" do not match. `; const l = this.response.body.affected; this._expect(l).toBeGreaterThanOrEqual(min || 1); if (max) this._expect(l).toBeLessThanOrEqual(max); } catch (e) { if (msg) e.message = msg + '\n\n' + e.message; Error.captureStackTrace(e, this.toBeAffected); throw e; } return this; } }