@faasjs/test

License: MITopen in new windowNPM Stable Versionopen in new windowNPM Beta Versionopen in new window

FaasJS's testing module.

Install

npm install @faasjs/test

Modules

Classes

Type aliases

Functions

Type aliases

Config

Ƭ Config: Object

Index signature

▪ [key: string]: any

Type declaration

NameType
plugins?{ [key: string]: { [key: string]: any; config?: { [key: string]: any; } ; provider?: string | ProviderConfig ; type: string }; }
providers?{ [key: string]: ProviderConfig; }

DeployData

Ƭ DeployData: Object

Index signature

▪ [key: string]: any

Type declaration

NameType
config?Config
dependencies{ [name: string]: string; }
env?string
filenamestring
logger?Logger
name?string
plugins?{ [name: string]: { [key: string]: any; config: { [key: string]: any; } ; name?: string ; plugin: Plugin ; provider?: string ; type: string }; }
rootstring
version?string

ExportedHandler

Ƭ ExportedHandler<TEvent, TContext, TResult>: (event: TEvent, context?: TContext, callback?: (...args: any) => any) => Promise<TResult>

Type parameters

NameType
TEventany
TContextany
TResultany

Type declaration

▸ (event, context?, callback?): Promise<TResult>

Parameters
NameType
eventTEvent
context?TContext
callback?(...args: any) => any
Returns

Promise<TResult>


FuncConfig

Ƭ FuncConfig<TEvent, TContext, TResult>: Object

Type parameters

NameType
TEventany
TContextany
TResultany

Type declaration

NameType
handler?Handler<TEvent, TContext, TResult>
plugins?Plugin[]

Handler

Ƭ Handler<TEvent, TContext, TResult>: (data: InvokeData<TEvent, TContext>) => Promise<TResult>

Type parameters

NameType
TEventany
TContextany
TResultany

Type declaration

▸ (data): Promise<TResult>

Parameters
NameType
dataInvokeData<TEvent, TContext>
Returns

Promise<TResult>


InvokeData

Ƭ InvokeData<TEvent, TContext, TResult>: Object

Type parameters

NameType
TEventany
TContextany
TResultany

Index signature

▪ [key: string]: any

Type declaration

NameType
callbackany
configConfig
contextTContext
eventTEvent
handler?Handler<TEvent, TContext, TResult>
loggerLogger
responseany

LifeCycleKey

Ƭ LifeCycleKey: "onDeploy" | "onMount" | "onInvoke"


MountData

Ƭ MountData: Object

Index signature

▪ [key: string]: any

Type declaration

NameType
configConfig
contextany
eventany

Next

Ƭ Next: () => Promise<void>

Type declaration

▸ (): Promise<void>

Returns

Promise<void>


Plugin

Ƭ Plugin: Object

Index signature

▪ [key: string]: any

Type declaration

NameType
namestring
typestring
onDeploy?(data: DeployData, next: Next) => void | Promise<void>
onInvoke?(data: InvokeData<any, any, any>, next: Next) => void | Promise<void>
onMount?(data: MountData, next: Next) => void | Promise<void>

ProviderConfig

Ƭ ProviderConfig: Object

Type declaration

NameType
config{ [key: string]: any; }
typestring

UseifyPlugin

Ƭ UseifyPlugin: Object

Type declaration

NameType
mount?(data: { config: Config }) => Promise<void>

Functions

test

test(initBy): FuncWarper

Parameters

NameType
initBystring | Func<any, any, any>

Returns

FuncWarper


useFunc

useFunc<TEvent, TContext, TResult>(handler): Func<TEvent, TContext, TResult>

Type parameters

NameType
TEventany
TContextany
TResultany

Parameters

NameType
handler() => Handler<TEvent, TContext, TResult>

Returns

Func<TEvent, TContext, TResult>


usePlugin

usePlugin<T>(plugin): T & UseifyPlugin

Type parameters

NameType
Textends Plugin

Parameters

NameType
pluginT & UseifyPlugin

Returns

T & UseifyPlugin