Comparing version 3.1.1 to 3.1.2
{ | ||
"name": "pactum", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"description": "REST API Testing Tool for all levels in a Test Pyramid", | ||
@@ -70,3 +70,3 @@ "main": "./src/index.js", | ||
"openapi-fuzzer-core": "^1.0.6", | ||
"pactum-matchers": "^1.0.5", | ||
"pactum-matchers": "^1.0.6", | ||
"parse-graphql": "^1.0.0", | ||
@@ -73,0 +73,0 @@ "phin": "^3.6.0", |
@@ -40,2 +40,3 @@ export type RequestMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS' | 'TRACE'; | ||
export interface InteractionExpectations { | ||
disable?: boolean; | ||
exercised?: boolean; | ||
@@ -42,0 +43,0 @@ callCount?: number; |
@@ -81,7 +81,10 @@ const assert = require('assert'); | ||
}; | ||
if (expects.exercised && !interaction.exercised) { | ||
if (expects.disable) { | ||
log.debug('Interaction expect exercised is skipped', intReq); | ||
} | ||
if (expects.exercised && !interaction.exercised && !expects.disable) { | ||
log.warn('Interaction Not Exercised', intReq); | ||
this.fail(`Interaction not exercised: ${interaction.request.method} - ${interaction.request.path}`); | ||
} | ||
if (!expects.exercised && interaction.exercised) { | ||
if (!expects.exercised && interaction.exercised && !expects.disable) { | ||
log.warn('Interaction got Exercised', intReq); | ||
@@ -91,3 +94,3 @@ this.fail(`Interaction exercised: ${interaction.request.method} - ${interaction.request.path}`); | ||
if (typeof expects.callCount !== 'undefined') { | ||
if (expects.callCount !== interaction.callCount) { | ||
if (expects.callCount !== interaction.callCount && !expects.disable) { | ||
this.fail(`Interaction call count ${interaction.callCount} !== ${expects.callCount} for ${interaction.request.method} - ${interaction.request.path}`); | ||
@@ -94,0 +97,0 @@ } |
@@ -34,3 +34,3 @@ const { setMatchingRules, getValue } = require('pactum-matchers').utils; | ||
if (!raw.expects) { | ||
raw.expects = { exercised: true }; | ||
raw.expects = { disable: false, exercised: true }; | ||
} | ||
@@ -40,2 +40,8 @@ if (typeof raw.expects.exercised === 'undefined') { | ||
} | ||
if (typeof raw.expects.disable === 'undefined') { | ||
raw.expects.disable = false; | ||
} | ||
if (raw.expects.disable) { | ||
raw.expects.exercised = false; | ||
} | ||
} | ||
@@ -178,2 +184,3 @@ } | ||
constructor(expects) { | ||
this.disable = expects.disable; | ||
this.exercised = expects.exercised; | ||
@@ -209,3 +216,3 @@ this.callCount = expects.callCount; | ||
expects, | ||
stores, | ||
stores | ||
} = raw; | ||
@@ -212,0 +219,0 @@ this.id = id || helper.getRandomId(); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
157288
4711
Updatedpactum-matchers@^1.0.6