UNPKG

@opra/testing

Version:
27 lines (26 loc) 873 B
import { IncomingMessage, Server, ServerResponse } from 'node:http'; import { FetchBackend, HttpResponse } from '@opra/client'; import { ApiExpect } from './api-expect/api-expect.js'; import type { OpraTestClient } from './test-client.js'; declare type RequestListener = (req: IncomingMessage, res: ServerResponse) => void; export type ResponseExt = { expect: ApiExpect; }; /** * * @class TestBackend */ export declare class TestBackend extends FetchBackend { protected _server: Server; constructor(app: Server | RequestListener, options?: OpraTestClient.Options); protected send(req: Request): Promise<Response>; protected createResponse(init: HttpResponse.Initiator): HttpResponse<any> & ResponseExt; } /** * @namespace TestBackend */ export declare namespace TestBackend { interface Options extends FetchBackend.Options { } } export {};