UNPKG

flagpole

Version:

Simple and fast DOM integration, headless or headful browser, and REST API testing framework.

32 lines 1.11 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.JsonResponse = void 0; const response_1 = require("../response"); const jpath_1 = require("./jpath"); class JsonResponse extends response_1.ProtoResponse { constructor() { super(...arguments); this.find = (path) => jpath_1.jpathFind(this, path); this.findAll = (path) => jpath_1.jpathFindAll(this, path); } init(httpResponse) { super.init(httpResponse); const jsonBody = httpResponse.jsonBody; this.jsonDoc = new jpath_1.JsonDoc(jsonBody); if (httpResponse.statusCode == 204) { this.context .assert("Response body should be empty with Status Code 204", httpResponse.body.length) .equals(0); } else { this.context .assert(`${this.scenario.typeName} data is valid.`, jsonBody) .type.not.equals("null"); } } getRoot() { return this.jsonBody.$; } } exports.JsonResponse = JsonResponse; //# sourceMappingURL=json-response.js.map