UNPKG

@apistudio/apim-cli

Version:

CLI for API Management Products

51 lines (50 loc) 4.35 kB
/** * Copyright Super iPaaS Integration LLC, an IBM Company 2024 */ export class AssertConstants { } AssertConstants.equals_template = 'pm.test(\'${name}\', function () { pm.expect(pm.response.${key}).to.equals(${value}); });'; AssertConstants.not_equals_template = 'pm.test(\'${name}\', function () { pm.expect(pm.response.${key}).to.not.equals(${value});});'; AssertConstants.h_equals_template = 'pm.test(\'${name}\', function () { pm.expect(pm.response.headers.get(\'${key}\')).to.equals(${value}); });'; AssertConstants.h_not_equals_template = 'pm.test(\'${name}\', function () { pm.expect(pm.response.headers.get(\'${key}\')).to.not.equals(${value});});'; AssertConstants.have_property_template = 'pm.test(\'${name}\', function () { pm.expect(pm.response.${key}).to.have.property(${value});});'; AssertConstants.not_have_property_template = 'pm.test(\'${name}\', function () { pm.expect(pm.response.${key}).to.not.have.property(${value});});'; AssertConstants.h_have_property_template = 'pm.test(\'${name}\', function () { pm.expect(pm.response.headers.get(${value})).exist;});'; AssertConstants.h_not_have_property_template = 'pm.test(\'${name}\', function () { pm.expect(pm.response.headers.get(${value})).not.exist;});'; AssertConstants.x_have_property_template = ' pm.test(\'${name}\', function () { var xmlResponse = pm.response.text(); xml2js.parseString(xmlResponse, function (err, result) { pm.expect(result.${key}).to.have.property(${value});});});'; AssertConstants.x_not_have_property_template = 'pm.test(\'${name}\', function () { var xmlResponse = pm.response.text(); xml2js.parseString(xmlResponse, function (err, result) { pm.expect(result.${key}).to.not.have.property(${value});});});'; AssertConstants.lessThan_template = 'pm.test(\'${name}\', function () { pm.expect(pm.response.${key}).to.be.lessThan(${value});});'; AssertConstants.greaterThan_template = 'pm.test(\'${name}\', function () { pm.expect(pm.response.${key}).to.be.greaterThan(${value});});'; AssertConstants.validateSchema_template = 'pm.test(\'${name}\', function () { pm.response.to.have.jsonSchema(${value});});'; AssertConstants.inValidateSchema_template = 'pm.test(\'${name}\', function () { pm.response.to.not.have.jsonSchema(${value});});'; AssertConstants.x_equals_template = 'pm.test(\'${name}\', function () { var xmlResponse = pm.response.text(); xml2js.parseString(xmlResponse, function (err, result) { pm.expect(result.${key}).to.eql(${value});});});'; AssertConstants.x_not_equals_template = 'pm.test(\'${name}\', function () { var xmlResponse = pm.response.text(); xml2js.parseString(xmlResponse, function (err, result) { pm.expect(result.${key}).to.not.eql(${value});});});'; AssertConstants.have_lengthOf_template = 'pm.test(\'${name}\', function () { pm.expect(pm.response.${key}).to.have.lengthOf(${value});});'; AssertConstants.include_template = 'pm.test(\'${name}\', function () { pm.expect(pm.response.${key}).to.include(${value}); });'; AssertConstants.common_template = 'const xml2js = require(\'xml2js\');'; AssertConstants.equals_action = 'equals'; AssertConstants.not_equals_action = 'notEquals'; AssertConstants.h_equals_action = 'h_equals'; AssertConstants.h_not_equals_action = 'h_notEquals'; AssertConstants.x_equals_action = 'x_equals'; AssertConstants.x_not_equals_action = 'x_notEquals'; AssertConstants.have_property_action = 'haveProperty'; AssertConstants.not_have_property_action = 'notHaveProperty'; AssertConstants.h_have_property_action = 'h_haveProperty'; AssertConstants.h_not_have_property_action = 'h_notHaveProperty'; AssertConstants.x_have_property_action = 'x_haveProperty'; AssertConstants.x_not_have_property_action = 'x_notHaveProperty'; AssertConstants.lessThan_action = 'lessThan'; AssertConstants.greaterThan_action = 'greaterThan'; AssertConstants.validateSchema_action = 'validateSchema'; AssertConstants.inValidateSchema_action = 'inValidateSchema'; AssertConstants.lengthOf_action = 'lengthOf'; AssertConstants.include_action = 'include'; AssertConstants.responseJsonTypeKey = 'json()'; AssertConstants.responseHeaderKey = 'header()'; AssertConstants.responseXmlTypeKey = 'xml()'; AssertConstants.responseTextTypeKey = 'text()'; AssertConstants.keyPlaceHolder = '${key}'; AssertConstants.valuePlaceHolder = '${value}'; AssertConstants.namePlaceHolder = '${name}'; AssertConstants.singleQuote = '\'';