tests

package
v0.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadEnv

func LoadEnv()

Loads the environment for the tests. It must be called before `m.Run` in the TestMain function of each package. It looks for a `.env.<testEnv>` file in the `internal/tests` directory, where `<testEnv>` is the value of the `-env` flag. If the file is not found, a warning is logged.

func RunTestOn

func RunTestOn(t *testing.T, envs ...TestEnv)

Runs the test only if the environment is in the list of environments provided. If no environment is provided, the test fails. If the environment is not in the list of environments, the test is skipped.

Packages like `account` and `rpc` are run on multiple environments, so in order to easily skip tests that are not supported on a specific environment, we use this helper. If a test is not supported on a specific environment, it should be skipped; otherwise, it could pass (since the environment is not being tested) and give a false positive.

Types

type TestEnv

type TestEnv string

An enum representing the environments for the test.

const (
	MockEnv           TestEnv = "mock"
	IntegrationEnv    TestEnv = "integration"
	TestnetEnv        TestEnv = "testnet"
	MainnetEnv        TestEnv = "mainnet"
	DevnetEnv         TestEnv = "devnet"
	Devnet_TestnetEnv TestEnv = "devnet-testnet"
)
var TEST_ENV TestEnv

The environment for the test defined by the `-env` flag. If not set, default: mock

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL