@metlo/testing
Advanced tools
Comparing version 0.2.9 to 0.2.10
@@ -86,2 +86,30 @@ "use strict"; | ||
}; | ||
const getRecentTraceHash = (traceHash) => { | ||
let res = { | ||
hash: null, | ||
timestamp: null, | ||
}; | ||
for (const hash in traceHash) { | ||
if (!res.timestamp || traceHash[hash] > res.timestamp) { | ||
res.hash = hash; | ||
res.timestamp = traceHash[hash]; | ||
} | ||
} | ||
return res; | ||
}; | ||
const getDataFieldInfo = (dataFields) => { | ||
let contentType = dataFields[0].contentType; | ||
let traceHash = getRecentTraceHash(dataFields[0].traceHash); | ||
for (const dataField of dataFields) { | ||
const currTraceHash = getRecentTraceHash(dataField.traceHash); | ||
if (dataField.contentType && | ||
(currTraceHash === null || currTraceHash === void 0 ? void 0 : currTraceHash.timestamp) && | ||
(traceHash === null || traceHash === void 0 ? void 0 : traceHash.timestamp) && | ||
(currTraceHash === null || currTraceHash === void 0 ? void 0 : currTraceHash.timestamp) > (traceHash === null || traceHash === void 0 ? void 0 : traceHash.timestamp)) { | ||
traceHash = Object.assign({}, currTraceHash); | ||
contentType = dataField.contentType; | ||
} | ||
} | ||
return { contentType, traceHash }; | ||
}; | ||
const addBodyToRequest = (gen, ctx) => { | ||
@@ -94,4 +122,5 @@ var _a, _b; | ||
} | ||
const contentType = dataFields[0].contentType; | ||
const filteredDataFields = dataFields.filter(e => e.contentType == contentType); | ||
const { contentType, traceHash } = getDataFieldInfo(dataFields); | ||
const filteredDataFields = dataFields.filter(e => e.contentType == contentType && | ||
(!traceHash.hash || e.traceHash[traceHash.hash])); | ||
let body = undefined; | ||
@@ -98,0 +127,0 @@ for (const dataField of filteredDataFields) { |
@@ -11,2 +11,3 @@ import { z } from "zod"; | ||
dataType: DataType; | ||
traceHash: Record<string, number>; | ||
} | ||
@@ -13,0 +14,0 @@ export interface GenTestEndpointAuthConfig { |
{ | ||
"name": "@metlo/testing", | ||
"version": "0.2.9", | ||
"version": "0.2.10", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
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
101385
1763