Documentation
¶
Index ¶
Constants ¶
View Source
const CallbackTestToken = "arc-test-token"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ARCAssertions ¶
type ARCAssertions interface {
Broadcasted() ARCBroadcastAssertions
}
type ARCBroadcastAssertions ¶
type ARCBroadcastAssertions interface {
WithTxID(txID string) ARCBroadcastAssertions
WithCallbackURL(url string) ARCBroadcastAssertions
WithCallbackToken(token string) ARCBroadcastAssertions
}
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 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 ¶
func WithDomainValidationDisabled ¶
func WithDomainValidationDisabled() ConfigOpts
func WithNotificationsEnabled ¶
func WithNotificationsEnabled() ConfigOpts
func WithPostgresConfig ¶
func WithPostgresConfig(host, port, user, password, dbName string) ConfigOpts
func WithSQLiteFilePath ¶
func WithSQLiteFilePath(dbPath string) ConfigOpts
func WithV2 ¶
func WithV2() ConfigOpts
type EngineAssertions ¶
type EngineAssertions interface {
ExternalPaymailHost() testpaymail.PaymailExternalAssertions
ARC() ARCAssertions
}
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
// User creates a new test fixture for Contacts
User(user fixtures.User) UserFixture
// Tx creates a new mocked transaction builder
Tx() txtestability.TransactionSpec
// GetPostgresContainer returns the shared PostgreSQL container instance
GetPostgresContainer() *testmode.TestContainer
}
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) txtestability.TransactionSpec
StoreData(data string) (txtestability.TransactionSpec, string)
}
FaucetFixture is a test fixture for the faucet service
type UserFixture ¶
type UserFixture interface {
HasContactTo(userB fixtures.User) *contactsmodels.Contact
HasConfirmedContactTo(userB fixtures.User) *contactsmodels.Contact
HasRejectedContactTo(userB fixtures.User) *contactsmodels.Contact
HasAwaitingContactTo(userB fixtures.User) *contactsmodels.Contact
}
UserFixture is a test fixture for the user management
Source Files
¶
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. |
Click to show internal directories.
Click to hide internal directories.