UNPKG

actionhero

Version:

The reusable, scalable, and quick node.js API server for stateless and stateful applications

47 lines (46 loc) 2.27 kB
import { UnwrapPromise } from "./tsUtils/unwrapPromise"; export declare namespace specHelper { /** * Generate a connection to use in your tests */ function buildConnection(): Promise<any>; /** * Run an action via the specHelper server. */ function runAction<ActionRunMethod>(actionName: string, input?: { [key: string]: any; }): Promise<(ActionRunMethod extends (data: { [key: string]: any; }) => Promise<import("../classes/action").ActionResponse> ? UnwrapPromise<ActionRunMethod> : any) & { error: string; }>; /** * Mock a specHelper connection requesting a file from the server. */ function getStaticFile(file: string): Promise<any>; /** * Use the specHelper to run a task. * Note: this only runs the task's `run()` method, and no middleware. This is faster than api.specHelper.runFullTask. */ function runTask<TaskRunMethod>(taskName: string, params: object | Array<any>): Promise<(TaskRunMethod extends (data: import("../classes/task").TaskInputs, worker: any) => Promise<any> ? UnwrapPromise<TaskRunMethod> : any) & { error: string; }>; /** * Use the specHelper to run a task. * Note: this will run a full Task worker, and will also include any middleware. This is slower than api.specHelper.runTask. */ function runFullTask<TaskRunMethod>(taskName: string, params: object | Array<any>): Promise<(TaskRunMethod extends (data: import("../classes/task").TaskInputs, worker: any) => Promise<any> ? UnwrapPromise<TaskRunMethod> : any) & { error: string; }>; /** * Use the specHelper to find enqueued instances of a task * This will return an array of instances of the task which have been enqueued either in the normal queues or delayed queues * If a task is enqueued in a delayed queue, it will have a 'timestamp' property * i.e. [ { class: 'regularTask', queue: 'testQueue', args: [ [Object] ] } ] */ function findEnqueuedTasks(taskName: string): Promise<any[]>; /** * Delete all enqueued instances of a task, both in all the normal queues and all of the delayed queues */ function deleteEnqueuedTasks(taskName: string, params: {}): Promise<void>; }