@ply-ct/ply
Version:
REST API Automated Testing
65 lines (64 loc) • 2.13 kB
TypeScript
import * as ts from 'typescript';
import { Request } from '../request';
import { FlowSuite } from '../flows';
import { Suite } from '../suite';
import { Ts } from '../ts';
import { EndpointMethod } from './plyex';
export interface MethodMeta {
name: string;
summary: string;
description?: string;
}
/**
* Raw info as parsed from plyex JSDoc tag.
*/
export interface PlyMeta {
request?: string;
responses?: {
[key: string]: string[];
};
}
export interface PlyEndpointMeta {
operationId?: string;
summaries: string[];
description?: string;
plyMeta?: PlyMeta;
examples?: {
request?: string;
responses?: {
[key: string]: string[];
};
};
}
export declare class PlyExampleRequest {
readonly options?: {
samplesFromActual?: boolean | undefined;
} | undefined;
readonly suitePath: string;
readonly requestName: string;
constructor(requestPath: string, options?: {
samplesFromActual?: boolean | undefined;
} | undefined);
getSuite(): Promise<Suite<Request> | FlowSuite>;
getExpected(): Promise<any>;
getActual(): Promise<any>;
getExampleRequest(): Promise<string | undefined>;
getExampleResponse(): Promise<string | undefined>;
private static requestSuites;
private static flowSuites;
private static expectedObjs;
private static actualObjs;
}
export declare class JsDocReader {
private ts;
readonly sourceFile: ts.SourceFile;
constructor(ts: Ts, sourceFile: ts.SourceFile);
getPlyEndpointMeta(endpointMethod: EndpointMethod, tag?: string, untaggedMethods?: boolean, samplesFromActual?: boolean): Promise<PlyEndpointMeta | undefined>;
/**
* Summary is first line or sentence of a JSDoc comment, if any.
* Description is the remainder.
*/
findMethodMeta(methodDeclaration: ts.MethodDeclaration): MethodMeta | undefined;
readStringMeta(methodDeclaration: ts.MethodDeclaration, tag: string): string | undefined;
readPlyMeta(className: string, methodDeclaration: ts.MethodDeclaration, tag: string): PlyMeta | undefined;
}