@opra/testing
Version:
Opra testing package
31 lines (30 loc) • 1.07 kB
TypeScript
import { FetchBackend, HttpClientBase, kBackend } from '@opra/client';
import { IncomingMessage, Server, ServerResponse } from 'http';
import { ApiExpect } from './api-expect/api-expect.js';
import { TestBackend } from './test-backend.js';
declare type RequestListener = (req: IncomingMessage, res: ServerResponse) => void;
export declare const kContext: unique symbol;
export type ResponseExt = {
expect: ApiExpect;
};
export declare namespace OpraTestClient {
interface Options extends FetchBackend.Options {
basePath?: string;
}
}
/**
* Test specific implementation of {@link HttpClientBase} for API testing.
*
* @class OpraTestClient
*/
export declare class OpraTestClient extends HttpClientBase<FetchBackend.RequestOptions, ResponseExt> {
[kBackend]: TestBackend;
/**
* Creates a new instance of OpraTestClient.
*
* @param app The server or request listener to test.
* @param options Configuration options.
*/
constructor(app: Server | RequestListener, options?: OpraTestClient.Options);
}
export {};