Skip to main content

@tairu/testing

Tairu testing library, providing utilities to test tile handlers.

Installation

npm install @tairu/testing

Classes

TestAgent

Extends

  • Loader

Constructors

new TestAgent()

new TestAgent(handlers, signer?): TestAgent

Parameters
handlers

TileHandlers

signer?

TokenSigner

Returns

TestAgent

Overrides

Loader.constructor

Accessors

signer
Get Signature

get signer(): ActionSigner

Returns

ActionSigner

Set Signature

set signer(value): void

Parameters
value

ActionSigner

Returns

void

Inherited from

Loader.signer

Defined in

Methods

createToken()

createToken(payload, useSigner?): Promise<string>

Parameters
payload

Record<string, unknown>

useSigner?

TokenSigner

Returns

Promise<string>


getRenderedTile()

getRenderedTile(path, format): Promise<string>

Parameters
path

string

format

RenderFormat

Returns

Promise<string>

Overrides

Loader.getRenderedTile


getStaticTileAsBox()

getStaticTileAsBox(url, options?): Promise<object>

Parameters
url

string

options?

Options

Returns

Promise<object>

props

props: object

props.children?

optional props.children: ({props: object;type: "Box" | "Image" | "Text"; } | object[])[]

props.key?

optional props.key: string

props.style?

optional props.style: object

props.style.alignItems?

optional props.style.alignItems: "flex-start" | "center" | "flex-end"

props.style.alignSelf?

optional props.style.alignSelf: "flex-start" | "center" | "flex-end" | "auto"

props.style.backgroundClip?

optional props.style.backgroundClip: "border-box" | "text"

props.style.backgroundColor?

optional props.style.backgroundColor: string

props.style.backgroundImage?

optional props.style.backgroundImage: string

props.style.backgroundPosition?

optional props.style.backgroundPosition: string

props.style.backgroundRepeat?

optional props.style.backgroundRepeat: "repeat" | "repeat-x" | "repeat-y" | "no-repeat"

props.style.backgroundSize?

optional props.style.backgroundSize: string

props.style.borderBottomColor?

optional props.style.borderBottomColor: string

props.style.borderBottomLeftRadius?

optional props.style.borderBottomLeftRadius: number

props.style.borderBottomRightRadius?

optional props.style.borderBottomRightRadius: number

props.style.borderBottomStyle?

optional props.style.borderBottomStyle: "solid" | "dashed"

props.style.borderBottomWidth?

optional props.style.borderBottomWidth: number

props.style.borderColor?

optional props.style.borderColor: string

props.style.borderLeftColor?

optional props.style.borderLeftColor: string

props.style.borderLeftStyle?

optional props.style.borderLeftStyle: "solid" | "dashed"

props.style.borderLeftWidth?

optional props.style.borderLeftWidth: number

props.style.borderRadius?

optional props.style.borderRadius: number

props.style.borderRightColor?

optional props.style.borderRightColor: string

props.style.borderRightStyle?

optional props.style.borderRightStyle: "solid" | "dashed"

props.style.borderRightWidth?

optional props.style.borderRightWidth: number

props.style.borderStyle?

optional props.style.borderStyle: "solid" | "dashed"

props.style.borderTopColor?

optional props.style.borderTopColor: string

props.style.borderTopLeftRadius?

optional props.style.borderTopLeftRadius: number

props.style.borderTopRightRadius?

optional props.style.borderTopRightRadius: number

props.style.borderTopStyle?

optional props.style.borderTopStyle: "solid" | "dashed"

props.style.borderTopWidth?

optional props.style.borderTopWidth: number

props.style.borderWidth?

optional props.style.borderWidth: number

props.style.bottom?

optional props.style.bottom: number

props.style.boxShadow?

optional props.style.boxShadow: string

props.style.display?

optional props.style.display: "flex" | "none"

props.style.flexBasis?

optional props.style.flexBasis: number

props.style.flexDirection?

optional props.style.flexDirection: "row" | "row-reverse" | "column" | "column-reverse"

props.style.flexGrow?

optional props.style.flexGrow: number

props.style.flexShrink?

optional props.style.flexShrink: number

props.style.flexWrap?

optional props.style.flexWrap: "nowrap" | "wrap" | "wrap-reverse"

props.style.gap?

optional props.style.gap: number

props.style.height?

optional props.style.height: number

props.style.justifyContent?

optional props.style.justifyContent: "flex-start" | "center" | "flex-end" | "space-between" | "space-around"

props.style.left?

optional props.style.left: number

props.style.margin?

optional props.style.margin: number

props.style.marginBottom?

optional props.style.marginBottom: number

props.style.marginLeft?

optional props.style.marginLeft: number

props.style.marginRight?

optional props.style.marginRight: number

props.style.marginTop?

optional props.style.marginTop: number

props.style.maxHeight?

optional props.style.maxHeight: number

props.style.maxWidth?

optional props.style.maxWidth: number

props.style.minHeight?

optional props.style.minHeight: number

props.style.minWidth?

optional props.style.minWidth: number

props.style.objectFit?

optional props.style.objectFit: "none" | "contain" | "cover"

props.style.opacity?

optional props.style.opacity: number

props.style.overflow?

optional props.style.overflow: "visible" | "hidden"

props.style.padding?

optional props.style.padding: number

props.style.paddingBottom?

optional props.style.paddingBottom: number

props.style.paddingLeft?

optional props.style.paddingLeft: number

props.style.paddingRight?

optional props.style.paddingRight: number

props.style.paddingTop?

optional props.style.paddingTop: number

props.style.position?

optional props.style.position: "relative" | "absolute"

props.style.right?

optional props.style.right: number

props.style.top?

optional props.style.top: number

props.style.width?

optional props.style.width: number

type

type: "Box"

Inherited from

Loader.getStaticTileAsBox


getTile()

getTile(path): Promise<object>

Parameters
path

string = '/'

Returns

Promise<object>

props

props: object

props.actions?

optional props.actions: ({label: string;type: "tairu:uri/open";uri: string; } | {label: string;payload: object;state: object;type: "tairu:did/sign"; } | {label: string;state: object;type: "tairu:did/submit"; })[]

props.children?

optional props.children: ({props: object;type: "Box" | "Image" | "Text"; } | object[])[]

props.description?

optional props.description: string

props.input?

optional props.input: {multiple: boolean;options: object[];type: "options"; } | {defaultValue: string;label: string;placeholder: string;secure: boolean;type: "text"; }

props.key?

optional props.key: string

props.style?

optional props.style: object

props.style.alignItems?

optional props.style.alignItems: "flex-start" | "center" | "flex-end"

props.style.alignSelf?

optional props.style.alignSelf: "flex-start" | "center" | "flex-end" | "auto"

props.style.backgroundClip?

optional props.style.backgroundClip: "border-box" | "text"

props.style.backgroundColor?

optional props.style.backgroundColor: string

props.style.backgroundImage?

optional props.style.backgroundImage: string

props.style.backgroundPosition?

optional props.style.backgroundPosition: string

props.style.backgroundRepeat?

optional props.style.backgroundRepeat: "repeat" | "repeat-x" | "repeat-y" | "no-repeat"

props.style.backgroundSize?

optional props.style.backgroundSize: string

props.style.borderBottomColor?

optional props.style.borderBottomColor: string

props.style.borderBottomLeftRadius?

optional props.style.borderBottomLeftRadius: number

props.style.borderBottomRightRadius?

optional props.style.borderBottomRightRadius: number

props.style.borderBottomStyle?

optional props.style.borderBottomStyle: "solid" | "dashed"

props.style.borderBottomWidth?

optional props.style.borderBottomWidth: number

props.style.borderColor?

optional props.style.borderColor: string

props.style.borderLeftColor?

optional props.style.borderLeftColor: string

props.style.borderLeftStyle?

optional props.style.borderLeftStyle: "solid" | "dashed"

props.style.borderLeftWidth?

optional props.style.borderLeftWidth: number

props.style.borderRadius?

optional props.style.borderRadius: number

props.style.borderRightColor?

optional props.style.borderRightColor: string

props.style.borderRightStyle?

optional props.style.borderRightStyle: "solid" | "dashed"

props.style.borderRightWidth?

optional props.style.borderRightWidth: number

props.style.borderStyle?

optional props.style.borderStyle: "solid" | "dashed"

props.style.borderTopColor?

optional props.style.borderTopColor: string

props.style.borderTopLeftRadius?

optional props.style.borderTopLeftRadius: number

props.style.borderTopRightRadius?

optional props.style.borderTopRightRadius: number

props.style.borderTopStyle?

optional props.style.borderTopStyle: "solid" | "dashed"

props.style.borderTopWidth?

optional props.style.borderTopWidth: number

props.style.borderWidth?

optional props.style.borderWidth: number

props.style.bottom?

optional props.style.bottom: number

props.style.boxShadow?

optional props.style.boxShadow: string

props.style.display?

optional props.style.display: "flex" | "none"

props.style.flexBasis?

optional props.style.flexBasis: number

props.style.flexDirection?

optional props.style.flexDirection: "row" | "row-reverse" | "column" | "column-reverse"

props.style.flexGrow?

optional props.style.flexGrow: number

props.style.flexShrink?

optional props.style.flexShrink: number

props.style.flexWrap?

optional props.style.flexWrap: "nowrap" | "wrap" | "wrap-reverse"

props.style.gap?

optional props.style.gap: number

props.style.height?

optional props.style.height: number

props.style.justifyContent?

optional props.style.justifyContent: "flex-start" | "center" | "flex-end" | "space-between" | "space-around"

props.style.left?

optional props.style.left: number

props.style.margin?

optional props.style.margin: number

props.style.marginBottom?

optional props.style.marginBottom: number

props.style.marginLeft?

optional props.style.marginLeft: number

props.style.marginRight?

optional props.style.marginRight: number

props.style.marginTop?

optional props.style.marginTop: number

props.style.maxHeight?

optional props.style.maxHeight: number

props.style.maxWidth?

optional props.style.maxWidth: number

props.style.minHeight?

optional props.style.minHeight: number

props.style.minWidth?

optional props.style.minWidth: number

props.style.objectFit?

optional props.style.objectFit: "none" | "contain" | "cover"

props.style.opacity?

optional props.style.opacity: number

props.style.overflow?

optional props.style.overflow: "visible" | "hidden"

props.style.padding?

optional props.style.padding: number

props.style.paddingBottom?

optional props.style.paddingBottom: number

props.style.paddingLeft?

optional props.style.paddingLeft: number

props.style.paddingRight?

optional props.style.paddingRight: number

props.style.paddingTop?

optional props.style.paddingTop: number

props.style.position?

optional props.style.position: "relative" | "absolute"

props.style.right?

optional props.style.right: number

props.style.top?

optional props.style.top: number

props.style.width?

optional props.style.width: number

props.title

props.title: string

type

type: "Tile"

version

version: "0.1"

Overrides

Loader.getTile


postAction()

postAction(path, action, useSigner?): Promise<object>

Parameters
path

string

action

{jwt: string;state: object;type: "tairu:did/sign"; }

action.jwt

string

action.state

object

action.type

"tairu:did/sign"

{state: object;type: "tairu:did/submit";value: string | number | boolean | (string | number | boolean)[]; }

action.state

object

action.type

"tairu:did/submit"

action.value

string | number | boolean | (string | number | boolean)[]

useSigner?

TokenSigner

Returns

Promise<object>

props

props: object

props.actions?

optional props.actions: ({label: string;type: "tairu:uri/open";uri: string; } | {label: string;payload: object;state: object;type: "tairu:did/sign"; } | {label: string;state: object;type: "tairu:did/submit"; })[]

props.children?

optional props.children: ({props: object;type: "Box" | "Image" | "Text"; } | object[])[]

props.description?

optional props.description: string

props.input?

optional props.input: {multiple: boolean;options: object[];type: "options"; } | {defaultValue: string;label: string;placeholder: string;secure: boolean;type: "text"; }

props.key?

optional props.key: string

props.style?

optional props.style: object

props.style.alignItems?

optional props.style.alignItems: "flex-start" | "center" | "flex-end"

props.style.alignSelf?

optional props.style.alignSelf: "flex-start" | "center" | "flex-end" | "auto"

props.style.backgroundClip?

optional props.style.backgroundClip: "border-box" | "text"

props.style.backgroundColor?

optional props.style.backgroundColor: string

props.style.backgroundImage?

optional props.style.backgroundImage: string

props.style.backgroundPosition?

optional props.style.backgroundPosition: string

props.style.backgroundRepeat?

optional props.style.backgroundRepeat: "repeat" | "repeat-x" | "repeat-y" | "no-repeat"

props.style.backgroundSize?

optional props.style.backgroundSize: string

props.style.borderBottomColor?

optional props.style.borderBottomColor: string

props.style.borderBottomLeftRadius?

optional props.style.borderBottomLeftRadius: number

props.style.borderBottomRightRadius?

optional props.style.borderBottomRightRadius: number

props.style.borderBottomStyle?

optional props.style.borderBottomStyle: "solid" | "dashed"

props.style.borderBottomWidth?

optional props.style.borderBottomWidth: number

props.style.borderColor?

optional props.style.borderColor: string

props.style.borderLeftColor?

optional props.style.borderLeftColor: string

props.style.borderLeftStyle?

optional props.style.borderLeftStyle: "solid" | "dashed"

props.style.borderLeftWidth?

optional props.style.borderLeftWidth: number

props.style.borderRadius?

optional props.style.borderRadius: number

props.style.borderRightColor?

optional props.style.borderRightColor: string

props.style.borderRightStyle?

optional props.style.borderRightStyle: "solid" | "dashed"

props.style.borderRightWidth?

optional props.style.borderRightWidth: number

props.style.borderStyle?

optional props.style.borderStyle: "solid" | "dashed"

props.style.borderTopColor?

optional props.style.borderTopColor: string

props.style.borderTopLeftRadius?

optional props.style.borderTopLeftRadius: number

props.style.borderTopRightRadius?

optional props.style.borderTopRightRadius: number

props.style.borderTopStyle?

optional props.style.borderTopStyle: "solid" | "dashed"

props.style.borderTopWidth?

optional props.style.borderTopWidth: number

props.style.borderWidth?

optional props.style.borderWidth: number

props.style.bottom?

optional props.style.bottom: number

props.style.boxShadow?

optional props.style.boxShadow: string

props.style.display?

optional props.style.display: "flex" | "none"

props.style.flexBasis?

optional props.style.flexBasis: number

props.style.flexDirection?

optional props.style.flexDirection: "row" | "row-reverse" | "column" | "column-reverse"

props.style.flexGrow?

optional props.style.flexGrow: number

props.style.flexShrink?

optional props.style.flexShrink: number

props.style.flexWrap?

optional props.style.flexWrap: "nowrap" | "wrap" | "wrap-reverse"

props.style.gap?

optional props.style.gap: number

props.style.height?

optional props.style.height: number

props.style.justifyContent?

optional props.style.justifyContent: "flex-start" | "center" | "flex-end" | "space-between" | "space-around"

props.style.left?

optional props.style.left: number

props.style.margin?

optional props.style.margin: number

props.style.marginBottom?

optional props.style.marginBottom: number

props.style.marginLeft?

optional props.style.marginLeft: number

props.style.marginRight?

optional props.style.marginRight: number

props.style.marginTop?

optional props.style.marginTop: number

props.style.maxHeight?

optional props.style.maxHeight: number

props.style.maxWidth?

optional props.style.maxWidth: number

props.style.minHeight?

optional props.style.minHeight: number

props.style.minWidth?

optional props.style.minWidth: number

props.style.objectFit?

optional props.style.objectFit: "none" | "contain" | "cover"

props.style.opacity?

optional props.style.opacity: number

props.style.overflow?

optional props.style.overflow: "visible" | "hidden"

props.style.padding?

optional props.style.padding: number

props.style.paddingBottom?

optional props.style.paddingBottom: number

props.style.paddingLeft?

optional props.style.paddingLeft: number

props.style.paddingRight?

optional props.style.paddingRight: number

props.style.paddingTop?

optional props.style.paddingTop: number

props.style.position?

optional props.style.position: "relative" | "absolute"

props.style.right?

optional props.style.right: number

props.style.top?

optional props.style.top: number

props.style.width?

optional props.style.width: number

props.title

props.title: string

type

type: "Tile"

version

version: "0.1"

Overrides

Loader.postAction


create()

static create(handlers, signer?): TestAgent

Parameters
handlers

TileHandlers

signer?

TokenSigner

Returns

TestAgent