@kubiklabs/wasmkit
Version:
Wasmkit is a development environment to compile, deploy, test, run cosmwasm contracts on different networks.
22 lines (21 loc) • 1.05 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.supportResponse = void 0;
function supportResponse(Assertion) {
Assertion.addMethod('respondWith', function (// eslint-disable-line @typescript-eslint/no-explicit-any
responseMessage // eslint-disable-line @typescript-eslint/no-explicit-any
) {
const subject = this._obj;
const strResponse = JSON.stringify(responseMessage);
const derivedPromise = subject.then((response) => {
response = JSON.stringify(response);
this.assert(response === strResponse, `Expected response "${strResponse}" to be returned, but ${response} was returned`, `Expected response "${strResponse}" NOT to be returned, but it was`);
});
this.then = derivedPromise.then.bind(derivedPromise);
this.catch = derivedPromise.catch.bind(derivedPromise);
this.promise = derivedPromise;
this.responseMessage = responseMessage;
return this;
});
}
exports.supportResponse = supportResponse;