@inngest/test
Version:
Tooling for testing Inngest functions.
43 lines (42 loc) • 1.45 kB
TypeScript
import { Context } from "inngest";
/**
* The default context transformation function that mocks all step tools. Use
* this in addition to your custom transformation function if you'd like to keep
* this functionality.
*/
export declare const mockCtx: (ctx: Readonly<Context.Any>) => Context.Any;
/**
* Creates a tiny mock invocation event used to replace or complement given
* event data.
*/
export declare const createMockEvent: () => {
id: string;
name: string;
data: {};
ts: number;
};
/**
* A deep partial, where every key of every object is optional.
*/
export type DeepPartial<T> = {
[K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];
};
/**
* Ensures that all keys in the subset are present in the actual object and that
* the values match.
*/
export declare const isDeeplyEqual: <T extends object>(subset: DeepPartial<T>, actual: T) => boolean;
type DeferredPromiseReturn<T> = {
promise: Promise<T>;
resolve: (value: T) => DeferredPromiseReturn<T>;
reject: (reason: any) => DeferredPromiseReturn<T>;
};
/**
* Creates and returns Promise that can be resolved or rejected with the
* returned `resolve` and `reject` functions.
*
* Resolving or rejecting the function will return a new set of Promise control
* functions. These can be ignored if the original Promise is all that's needed.
*/
export declare const createDeferredPromise: <T>() => DeferredPromiseReturn<T>;
export {};