@faasjs/test
FaasJS's testing module.
Install
npm install @faasjs/test
Modules
Classes
Type aliases
- Config
- DeployData
- ExportedHandler
- FuncConfig
- Handler
- InvokeData
- LifeCycleKey
- MountData
- Next
- Plugin
- ProviderConfig
- UseifyPlugin
Functions
Type aliases
Config
Ƭ Config: Object
Index signature
▪ [key: string
]: any
Type declaration
Name | Type |
---|---|
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
Name | Type |
---|---|
config? | Config |
dependencies | { [name: string] : string ; } |
env? | string |
filename | string |
logger? | Logger |
name? | string |
plugins? | { [name: string] : { [key: string] : any ; config : { [key: string] : any ; } ; name? : string ; plugin : Plugin ; provider? : string ; type : string }; } |
root | string |
version? | string |
ExportedHandler
Ƭ ExportedHandler<TEvent
, TContext
, TResult
>: (event
: TEvent
, context?
: TContext
, callback?
: (...args
: any
) => any
) => Promise
<TResult
>
Type parameters
Name | Type |
---|---|
TEvent | any |
TContext | any |
TResult | any |
Type declaration
▸ (event
, context?
, callback?
): Promise
<TResult
>
Parameters
Name | Type |
---|---|
event | TEvent |
context? | TContext |
callback? | (...args : any ) => any |
Returns
Promise
<TResult
>
FuncConfig
Ƭ FuncConfig<TEvent
, TContext
, TResult
>: Object
Type parameters
Name | Type |
---|---|
TEvent | any |
TContext | any |
TResult | any |
Type declaration
Name | Type |
---|---|
handler? | Handler <TEvent , TContext , TResult > |
plugins? | Plugin [] |
Handler
Ƭ Handler<TEvent
, TContext
, TResult
>: (data
: InvokeData
<TEvent
, TContext
>) => Promise
<TResult
>
Type parameters
Name | Type |
---|---|
TEvent | any |
TContext | any |
TResult | any |
Type declaration
▸ (data
): Promise
<TResult
>
Parameters
Name | Type |
---|---|
data | InvokeData <TEvent , TContext > |
Returns
Promise
<TResult
>
InvokeData
Ƭ InvokeData<TEvent
, TContext
, TResult
>: Object
Type parameters
Name | Type |
---|---|
TEvent | any |
TContext | any |
TResult | any |
Index signature
▪ [key: string
]: any
Type declaration
Name | Type |
---|---|
callback | any |
config | Config |
context | TContext |
event | TEvent |
handler? | Handler <TEvent , TContext , TResult > |
logger | Logger |
response | any |
LifeCycleKey
Ƭ LifeCycleKey: "onDeploy"
| "onMount"
| "onInvoke"
MountData
Ƭ MountData: Object
Index signature
▪ [key: string
]: any
Type declaration
Name | Type |
---|---|
config | Config |
context | any |
event | any |
Next
Ƭ Next: () => Promise
<void
>
Type declaration
▸ (): Promise
<void
>
Returns
Promise
<void
>
Plugin
Ƭ Plugin: Object
Index signature
▪ [key: string
]: any
Type declaration
Name | Type |
---|---|
name | string |
type | string |
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
Name | Type |
---|---|
config | { [key: string] : any ; } |
type | string |
UseifyPlugin
Ƭ UseifyPlugin: Object
Type declaration
Name | Type |
---|---|
mount? | (data : { config : Config }) => Promise <void > |
Functions
test
▸ test(initBy
): FuncWarper
Parameters
Name | Type |
---|---|
initBy | string | Func <any , any , any > |
Returns
useFunc
▸ useFunc<TEvent
, TContext
, TResult
>(handler
): Func
<TEvent
, TContext
, TResult
>
Type parameters
Name | Type |
---|---|
TEvent | any |
TContext | any |
TResult | any |
Parameters
Name | Type |
---|---|
handler | () => Handler <TEvent , TContext , TResult > |
Returns
Func
<TEvent
, TContext
, TResult
>
usePlugin
▸ usePlugin<T
>(plugin
): T
& UseifyPlugin
Type parameters
Name | Type |
---|---|
T | extends Plugin |
Parameters
Name | Type |
---|---|
plugin | T & UseifyPlugin |
Returns
T
& UseifyPlugin