Module test

Source
Expand description

Helper types for writing integration tests for WebAssembly applications.

Integration tests are usually written in the tests directory in the root of the crate’s directory (i.e., beside the src directory). Linera application integration tests should be executed targeting the host architecture, instead of targeting wasm32-unknown-unknown like done for unit tests.

Structs§

ActiveChain
A reference to a single microchain inside a TestValidator.
BlockBuilder
A helper type to build a block proposal using the builder pattern, and then signing them into ConfirmedBlockCertificates using a TestValidator.
HttpServer
A handle to a running HTTP server.
QueryOutcome
The outcome of the execution of a query.
TestValidator
A minimal validator implementation suited for tests.

Enums§

ChainError
ChainExecutionContext
ExecutionError
A type for errors happening during execution.
MessageAction
What to do with a message picked from the inbox.
Recipient
The recipient of a transfer.
TryGraphQLMutationError
Failure to perform a GraphQL mutation on an application on a chain.
TryGraphQLQueryError
Failure to perform a GraphQL query on an application on a chain.
TryQueryError
Failure to query an application’s service on a chain.
WasmExecutionError
Errors that can occur when executing a user application in a WebAssembly module.
WorkerError
Error type for worker operations.

Functions§

log_messages
Returns all messages logged so far.
mock_application_id
Sets the mocked application ID.
mock_application_parameters
Sets the mocked application parameters.
mock_application_state
Sets the mocked application state.
mock_chain_balance
Sets the mocked chain balance.
mock_chain_id
Sets the mocked chain ID.
mock_key_value_store
Initializes and returns a view context for using as the mocked key-value store.
mock_system_timestamp
Sets the mocked system timestamp.
mock_try_query_application
Mocks the try_query_application system API.
test_contract_runtime
Creates a ContractRuntime to use in tests.
test_service_runtime
Creates a ServiceRuntime to use in tests.