phecda-server
Version:
server framework that provide IOC/type-reuse/http&rpc-adaptor
24 lines (21 loc) • 1.11 kB
TypeScript
import * as supertest from 'supertest';
import { Test } from 'supertest';
import { Server } from 'node:http';
import { Construct } from 'phecda-core';
import { F as Factory } from './core-qL97H3d_.js';
import { C as CustomResponse } from './meta-EGS-4cNY.js';
type PickFuncKeys<Type> = {
[Key in keyof Type]: Type[Key] extends (...args: any) => any ? (ReturnType<Type[Key]> extends CustomResponse<any> ? never : Key) : never;
}[keyof Type];
type PickFunc<Instance> = Pick<Instance, PickFuncKeys<Instance>>;
declare function TestFactory<T extends Construct[]>(...Modules: T): Promise<{
get<C extends T[number]>(Model: C): InstanceType<C>;
}>;
type SuperTestRequest<T> = {
[K in keyof T]: T[K] extends (...args: infer R) => any ? (...args: R) => Test : never;
};
declare function TestHttp(app: Server | any, { moduleMap, meta }: Awaited<ReturnType<typeof Factory>>, isAgent?: boolean): Promise<{
module: <T extends Construct>(Module: T) => SuperTestRequest<PickFunc<InstanceType<T>>>;
agent: typeof supertest.agent;
}>;
export { type PickFunc, type SuperTestRequest, TestFactory, TestHttp };