Comparing version 3.6.4 to 3.6.5
{ | ||
"name": "pactum", | ||
"version": "3.6.4", | ||
"version": "3.6.5", | ||
"description": "REST API Testing Tool for all levels in a Test Pyramid", | ||
@@ -5,0 +5,0 @@ "main": "./src/index.js", |
@@ -9,8 +9,8 @@ /** | ||
/** | ||
* loads data maps | ||
* adds data maps | ||
* @example | ||
* stash.addDataMap({ | ||
* 'User': { | ||
* 'Name': 'Snow', | ||
* 'Age': 26 | ||
* name: 'Snow', | ||
* age: 26 | ||
* } | ||
@@ -20,9 +20,43 @@ * }); | ||
export function addDataMap(maps: object): void; | ||
/** | ||
* adds data maps | ||
* @example | ||
* stash.addDataMap([ | ||
* { | ||
* 'UserOne': { name: 'Snow' } | ||
* } | ||
* { | ||
* 'UserTwo': { name: 'John' } | ||
* } | ||
* ]); | ||
*/ | ||
export function addDataMap(maps: object[]): void; | ||
/** | ||
* loads data templates | ||
* adds data maps | ||
* @example | ||
* stash.addDataMap('PASSWORD', 'password@123'); | ||
* stash.addDataMap('CREDENTIALS', { username: 'john', password: 'password@123' }); | ||
*/ | ||
export function addDataMap(key: string, value: any): void; | ||
/** | ||
* returns data map | ||
*/ | ||
export function getDataMap(): object; | ||
/** | ||
* @example | ||
* const username = stash.getDataMap('CREDENTIALS.username'); | ||
*/ | ||
export function getDataMap(path: string): any; | ||
export function clearDataMaps(): void; | ||
/** | ||
* adds data templates | ||
* @example | ||
* stash.addDataTemplate({ | ||
* 'User.NewUser': { | ||
* 'User:NewUser': { | ||
* 'Name': 'Snow', | ||
@@ -37,5 +71,45 @@ * 'Age': 26, | ||
export function getDataMap(): object; | ||
/** | ||
* | ||
* @example | ||
* stash.addDataTemplate('USER:NEW', { name: 'john', age: 28 }); | ||
*/ | ||
export function addDataTemplate(key: string, value: object): void; | ||
export function getDataTemplate(): object; | ||
/** | ||
* @example | ||
* const credentials = stash.getDataTemplate('CREDENTIALS'); | ||
*/ | ||
export function getDataTemplate(path: string): object; | ||
export function clearDataTemplates(): void; | ||
/** | ||
* adds data store | ||
* @example | ||
* stash.addDataStore({ | ||
* 'User': { | ||
* name: 'Snow', | ||
* age: 26 | ||
* } | ||
* }); | ||
*/ | ||
export function addDataStore(store: object): void; | ||
/** | ||
* adds data stores | ||
* @example | ||
* stash.addDataStore('PASSWORD', 'password@123'); | ||
* stash.addDataStore('CREDENTIALS', { username: 'john', password: 'password@123' }); | ||
*/ | ||
export function addDataStore(key: string, value: any): void; | ||
export function getDataStore(): object; | ||
export function getDataStore(path: string): any; | ||
export function clearDataStores(): void; | ||
export function getStoreKey(key: string): string; | ||
@@ -42,0 +116,0 @@ export function getMapKey(key: string): string; |
@@ -6,2 +6,3 @@ const fs = require('fs'); | ||
const config = require('../config'); | ||
const jq = require('json-query'); | ||
@@ -44,11 +45,18 @@ let dataMap = {}; | ||
addDataMap(maps) { | ||
if (!Array.isArray(maps)) { | ||
maps = [maps]; | ||
addDataMap(key, value) { | ||
if (value) { | ||
Object.assign(dataMap, { [key]: value }); | ||
} else { | ||
if (!Array.isArray(key)) { | ||
key = [key]; | ||
} | ||
key.forEach(map => Object.assign(dataMap, map)); | ||
} | ||
maps.forEach(map => Object.assign(dataMap, map)); | ||
config.data.ref.map.processed = false; | ||
}, | ||
getDataMap() { | ||
getDataMap(path) { | ||
if (path) { | ||
return jq(path, { data: dataMap }).value; | ||
} | ||
return dataMap; | ||
@@ -63,11 +71,19 @@ }, | ||
addDataTemplate(templates) { | ||
if (!Array.isArray(templates)) { | ||
templates = [templates]; | ||
addDataTemplate(key, value) { | ||
if (value) { | ||
Object.assign(dataTemplate, { [key]: value }); | ||
} else { | ||
if (!Array.isArray(key)) { | ||
key = [key]; | ||
} | ||
key.forEach(template => Object.assign(dataTemplate, template)); | ||
} | ||
templates.forEach(template => Object.assign(dataTemplate, template)); | ||
config.data.template.processed = false; | ||
}, | ||
getDataTemplate() { | ||
getDataTemplate(path) { | ||
if (path) { | ||
console.log(dataTemplate) | ||
return jq(path, { data: dataTemplate }).value; | ||
} | ||
return dataTemplate; | ||
@@ -82,8 +98,15 @@ }, | ||
addDataStore(store) { | ||
Object.assign(dataStore, store); | ||
addDataStore(key, value) { | ||
if (value) { | ||
Object.assign(dataStore, { [key]: value }); | ||
} else { | ||
Object.assign(dataStore, key); | ||
} | ||
config.data.ref.spec.enabled = true; | ||
}, | ||
getDataStore() { | ||
getDataStore(path) { | ||
if (path) { | ||
return jq(path, { data: dataStore }).value; | ||
} | ||
return dataStore; | ||
@@ -90,0 +113,0 @@ }, |
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
173533
5220