UNPKG

@averagehelper/corde

Version:

A simple library for Discord bot tests. (Republished fork to demonstrate a bugfix)

50 lines (49 loc) 1.84 kB
import { CordeBot } from "../../core"; import { TestReport } from "../interfaces"; /** * Entity helper for expectation assertions used for Corde tests * * @description Have 3 generic parameters that serves to define * what are the data that the test function will receive. * * These data will be used in action() command, witch will be implemented * by the inherited class. * */ export declare abstract class ExpectOperation<P1 = any, P2 = any, P3 = any> { protected isEqual: boolean; protected output: any; protected expectation: any; protected hasPassed: boolean; protected showExpectAndOutputValue: boolean; protected customReturnMessage?: string; /** * Defines if the definition of **isEqual** should be * kept independent of **isNot** value. */ protected forceIsEqualValue: boolean; protected readonly isNot: boolean; protected readonly command: string; protected readonly cordeBot: CordeBot; /** * Initialize the match class with its default values. * * @param cordeBot The instance of CordeBot initialized by the runtime. * @param command The command to execute. * @param isNot Definition if this is a deny test. */ constructor(cordeBot: CordeBot, command: string, isNot: boolean); /** * Execute the test, checking if a command did what was proposed to do. * * @param p1 First parameter of the test. * @param p2 Second parameter of the test. * @param p3 Thirty parameter of the test. * * @returns A report of the executed command. */ abstract action(p1: P1, p2: P2, p3: P3): Promise<TestReport>; protected catchExecutionError<T extends Error | unknown>(error: T): void; protected generateReport(showExpectAndOutputValue?: boolean): TestReport; private defineIsEqual; }