A library of test of helper functions specific to Antelope smart contracts
Waits for promise and checks if exception is thrown and message matches exception error message.
Parameters
- promise - Promise <any>: Any promise that throws an exception
- message - string: The string to match against the execption error message
Returns
Promise<boolean>: True if message was matched
getAllActions(actionTraces: ActionTrace[]): { account: string, name: string, data?: object, authorization?: Authorization[] }[]
Extracts a list of all actions from the actionsTraces parameter.
Parameters
- actionTraces: ActionTrace[] - List of action traces
Returns
A list of actions
{
account: string,
name: string,
data?: object,
authorization?: Authorization[]
}
expectAction(transaction: TransactResult,expectedAction: {account: string; name: string; data?: object; authorization?: Authorization[];}: boolean
Checks if the transaction parameter contains expectedAction
Parameters
- transaction: TransactResult - Transaction result of an executed transaction
- expectedAction: {account: string; name: string; data?: object; authorization?: Authorization[];} - The action expected to included in TransactResult
Returns
boolean: true if transaction contains expectedTransaction
Checks that account balance is equal to expectedBalance
Parameters
- account: Account - Account to query balance of
- expectedBalance: Asset - The exepcted balance of account