@n1k1t/mock-server
Version:
The ultimate toolkit to intercept, transform, and simulate HTTP/WS traffic with type-safe expectations
35 lines • 1.1 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Client = void 0;
const helpers_1 = require("../helpers");
class Client {
constructor(methods) {
this.methods = methods;
}
get ping() {
return this.methods.ping;
}
get deleteExpectations() {
return this.methods.expectationsDelete;
}
createExpectation(predicate) {
return typeof predicate === 'function'
? this.methods.expectationsCreate(predicate(this.compileHandlerContext()))
: this.methods.expectationsCreate(predicate);
}
updateExpectation(predicate) {
return typeof predicate === 'function'
? this.methods.expectationsUpdate(predicate(this.compileHandlerContext()))
: this.methods.expectationsUpdate(predicate);
}
compileHandlerContext() {
return {
$: (0, helpers_1.compileExpectationOperators)(),
utils: {
transports: (values) => values,
},
};
}
}
exports.Client = Client;
//# sourceMappingURL=client.js.map