@httpc/kit
Version:
httpc toolbox for building function-based API with minimal code and end-to-end type safety
21 lines (20 loc) • 635 B
JavaScript
import { httpPipelineTester, httpCall, createHttpCServerTester } from "@httpc/server";
import { initializeContainer } from "../di";
export class ApplicationTester {
constructor(options) {
this.options = options;
this.server = createHttpCServerTester(options);
}
async initialize() {
await initializeContainer();
}
newCall() {
return this.server.newCall;
}
createCall(...pipeline) {
return httpPipelineTester(this.options?.middlewares, httpCall(...pipeline));
}
runCall(...pipeline) {
return this.createCall(...pipeline)();
}
}