Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pactum

Package Overview
Dependencies
Maintainers
1
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pactum - npm Package Compare versions

Comparing version 3.1.1 to 3.1.2

4

package.json
{
"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();

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc