@gatling.io/core
Version:
Gatling JS is a JavaScript/TypeScript interface for the [Gatling load testing tool](https://gatling.io/).
36 lines (35 loc) • 1.66 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.doIfEqualsImpl = exports.doIfImpl = void 0;
const session_1 = require("../session");
const wrapThen = (jvmThen, wrap) => ({
then: (executable, ...executables) => wrap(jvmThen.then(executable._underlying, ...executables.map((e) => e._underlying)))
});
const doIfImpl = (jvmDoIf, wrap) => (condition) => wrapThen(typeof condition === "function" ? jvmDoIf.doIf((0, session_1.underlyingSessionTo)(condition)) : jvmDoIf.doIf(condition), wrap);
exports.doIfImpl = doIfImpl;
const doIfEqualsImpl = (jvmDoIfEquals, wrap) => (actual, expected) => {
if (typeof actual === "function") {
const wrappedActual = (0, session_1.underlyingSessionTo)(actual);
if (typeof expected === "function") {
return wrapThen(jvmDoIfEquals.doIfEquals(wrappedActual, (0, session_1.underlyingSessionTo)(expected)), wrap);
}
else if (typeof expected === "string") {
return wrapThen(jvmDoIfEquals.doIfEquals(wrappedActual, expected), wrap);
}
else {
return wrapThen(jvmDoIfEquals.doIfEquals(wrappedActual, expected), wrap);
}
}
else {
if (typeof expected === "function") {
return wrapThen(jvmDoIfEquals.doIfEquals(actual, (0, session_1.underlyingSessionTo)(expected)), wrap);
}
else if (typeof expected === "string") {
return wrapThen(jvmDoIfEquals.doIfEquals(actual, expected), wrap);
}
else {
return wrapThen(jvmDoIfEquals.doIfEquals(actual, expected), wrap);
}
}
};
exports.doIfEqualsImpl = doIfEqualsImpl;