testabilities

package
v1.0.0-beta.43 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2025 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ARCFixture

type ARCFixture interface {
	// WillRespondForBroadcast returns a http response for a broadcast request.
	WillRespondForBroadcast(httpCode int, info *chainmodels.TXInfo)

	// WillRespondForBroadcastWithSeenOnNetwork is a default ARC behavior for broadcasting (happy path).
	WillRespondForBroadcastWithSeenOnNetwork(txID string)
}

type BalanceAssertions

type BalanceAssertions interface {
	IsEqualTo(expected bsv.Satoshis)
	IsGreaterThanOrEqualTo(expected bsv.Satoshis)
	IsZero()
}

type BlockHeadersServiceFixture

type BlockHeadersServiceFixture interface {
	// WillRespondForMerkleRoots returns a http response for get merkleroots endpoint with
	// provided httpCode and response
	WillRespondForMerkleRoots(httpCode int, response string)

	// WillRespondForMerkleRootsVerify returns a MerkleRootsConfirmations response for get merkleroot/verify endpoint with
	// provided httpCode
	WillRespondForMerkleRootsVerify(httpCode int, response *chainmodels.MerkleRootsConfirmations)
}

type ConfigOpts

type ConfigOpts func(*config.AppConfig)

func WithDomainValidationDisabled

func WithDomainValidationDisabled() ConfigOpts

func WithNotificationsEnabled

func WithNotificationsEnabled() ConfigOpts

func WithV2

func WithV2() ConfigOpts

type EngineAssertions

type EngineAssertions interface {
	ExternalPaymailHost() PaymailExternalAssertions
}

func Then

func Then(t testing.TB, engFixture EngineFixture) EngineAssertions

type EngineFixture

type EngineFixture interface {
	Engine() (walletEngine EngineWithConfig, cleanup func())
	EngineWithConfiguration(opts ...ConfigOpts) (walletEngine EngineWithConfig, cleanup func())
	PaymailClient() *paymailmock.PaymailClientMock

	// ConfigForTests returns a configuration with default values for tests and with the provided options applied.
	ConfigForTests(opts ...ConfigOpts) *config.AppConfig

	// NewTest creates a new test fixture based on the current one and the provided testing.TB
	// This is useful if you want to start spv-wallet once and then run multiple t.Run with some calls against this one instance.
	NewTest(t testing.TB) EngineFixture

	// BHS creates a new test fixture for Block Header Service (BHS)
	BHS() BlockHeadersServiceFixture

	// ARC creates a new test fixture for ARC
	ARC() ARCFixture

	// Faucet creates a new test fixture for Faucet
	Faucet(user fixtures.User) FaucetFixture
}

func Given

func Given(t testing.TB) EngineFixture

type EngineWithConfig

type EngineWithConfig struct {
	Config config.AppConfig
	Engine engine.ClientInterface
}

type FaucetFixture

type FaucetFixture interface {
	TopUp(satoshis bsv.Satoshis) fixtures.GivenTXSpec
	StoreData(data string) (fixtures.GivenTXSpec, string)
}

FaucetFixture is a test fixture for the faucet service

type PaymailCapabilityCallAssertions

type PaymailCapabilityCallAssertions interface {
	WithRequestJSONMatching(expectedTemplateFormat string, params map[string]any)
}

type PaymailExternalAssertions

type PaymailExternalAssertions interface {
	ReceivedBeefTransaction(sender, beef, reference string)
}

type UserAssertions

type UserAssertions interface {
	Balance() BalanceAssertions
}

Directories

Path Synopsis
Package testmode provides functions to set special modes for tests, allowing to use actual Postgres or SQLite file for testing, especially for development purposes.
Package testmode provides functions to set special modes for tests, allowing to use actual Postgres or SQLite file for testing, especially for development purposes.

Jump to

Keyboard shortcuts

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