@nestia/e2e
Advanced tools
Comparing version 0.3.1 to 0.3.2
@@ -152,4 +152,6 @@ "use strict"; | ||
return function (task) { | ||
var message = function () { | ||
return "Bug on ".concat(title, ": status code must be ").concat(status, "."); | ||
var message = function (actual) { | ||
return typeof actual === "number" | ||
? "Bug on ".concat(title, ": status code must be ").concat(status, ", but ").concat(actual, ".") | ||
: "Bug on ".concat(title, ": status code must be ").concat(status, ", but succeeded."); | ||
}; | ||
@@ -161,3 +163,6 @@ var predicate = function (exp) { | ||
? null | ||
: new Error(message()); | ||
: new Error(message(typeof exp === "object" && | ||
exp.constructor.name === "HttpError" | ||
? exp.status | ||
: undefined)); | ||
}; | ||
@@ -164,0 +169,0 @@ try { |
{ | ||
"name": "@nestia/e2e", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "E2E test utilify functions", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -107,4 +107,6 @@ import { is_sorted } from "tstl/ranges"; | ||
<T>(task: () => T): T extends Promise<any> ? Promise<void> : void => { | ||
const message = () => | ||
`Bug on ${title}: status code must be ${status}.`; | ||
const message = (actual?: number) => | ||
typeof actual === "number" | ||
? `Bug on ${title}: status code must be ${status}, but ${actual}.` | ||
: `Bug on ${title}: status code must be ${status}, but succeeded.`; | ||
const predicate = (exp: any): Error | null => | ||
@@ -115,3 +117,10 @@ typeof exp === "object" && | ||
? null | ||
: new Error(message()); | ||
: new Error( | ||
message( | ||
typeof exp === "object" && | ||
exp.constructor.name === "HttpError" | ||
? exp.status | ||
: undefined, | ||
), | ||
); | ||
try { | ||
@@ -118,0 +127,0 @@ const output: T = task(); |
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
137656
2704