UNPKG

@apistudio/apim-cli

Version:

CLI for API Management Products

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