Skip to content

@gala-chain/testAPI


API > transactionErrorCode

Function: transactionErrorCode()

transactionErrorCode(code): AsymmetricMatcher_2

Creates a Jest matcher for asserting GalaChain transaction error responses with a specific error code.

Parameters

code: number

The expected error code to match

Returns

A Jest matcher object that can be used with expect().toEqual()

Example

// Assert error response has specific error code
expect(response).toEqual(transactionErrorCode(404));
expect(response).toEqual(transactionErrorCode(400));

Source

chain-test/src/matchers.ts:116