testutils

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Mock

func Mock(method string, path string, status int, response any) *httptest.Server

Types

type DoSignedResult

type DoSignedResult struct {
	Response *http.Response
	Error    error
}

DoSignedResult is specific for the DoSigned method.

Go does not support multi-value returns for generics (i.e [T, (R, err)] Consider adding a generic tuple in the future to avoid defining responses for every function that we want to spy on.

Source: https://github.com/golang/go/issues/61920#issuecomment-1676117645

type MockJWKBuilder

type MockJWKBuilder struct {
	// contains filtered or unexported fields
}

func NewMockJWKBuilder

func NewMockJWKBuilder() *MockJWKBuilder

func (*MockJWKBuilder) Build

func (b *MockJWKBuilder) Build() was.JsonWebKey

func (*MockJWKBuilder) BuildSet

func (b *MockJWKBuilder) BuildSet() was.JsonWebKeySet

func (*MockJWKBuilder) WithAlg

func (*MockJWKBuilder) WithCrv

func (*MockJWKBuilder) WithKid

func (b *MockJWKBuilder) WithKid(kid string) *MockJWKBuilder

func (*MockJWKBuilder) WithKty

func (*MockJWKBuilder) WithX

func (b *MockJWKBuilder) WithX(x string) *MockJWKBuilder

type MockWalletAddressBuilder

type MockWalletAddressBuilder struct {
	// contains filtered or unexported fields
}

func NewMockWalletAddressBuilder

func NewMockWalletAddressBuilder() *MockWalletAddressBuilder

func (*MockWalletAddressBuilder) Build

func (*MockWalletAddressBuilder) WithAssetCode

func (b *MockWalletAddressBuilder) WithAssetCode(assetCode string) *MockWalletAddressBuilder

func (*MockWalletAddressBuilder) WithAssetScale

func (b *MockWalletAddressBuilder) WithAssetScale(assetScale int) *MockWalletAddressBuilder

func (*MockWalletAddressBuilder) WithAuthServer

func (b *MockWalletAddressBuilder) WithAuthServer(authServer string) *MockWalletAddressBuilder

func (*MockWalletAddressBuilder) WithID

func (*MockWalletAddressBuilder) WithPublicName

func (b *MockWalletAddressBuilder) WithPublicName(publicName string) *MockWalletAddressBuilder

func (*MockWalletAddressBuilder) WithResourceServer

func (b *MockWalletAddressBuilder) WithResourceServer(resourceServer string) *MockWalletAddressBuilder

type Spy

type Spy[T any, R any] struct {
	Calls   []T
	Results []R // outputs
	Target  func(T) R
}

func SpyOn

func SpyOn[T any, R any](target func(T) R) *Spy[T, R]

SpyOn creates a new Spy for functions with a single input and a single output.

Because of Go's generic constraints, this spy supports only functions of the form: func(T) R

Functions with multiple arguments must wrap their inputs in a struct or tuple Similarly, multiple return values must be wrapped (e.g., using a custom struct or tuples).

This limitation *should* be acceptable for our use case, as we primarily want to spy on request-based functions such as `DoSigned` (Node SDK parity).

func (*Spy[T, R]) CallCount

func (s *Spy[T, R]) CallCount() int

func (*Spy[T, R]) Func

func (s *Spy[T, R]) Func() func(T) R

func (*Spy[T, R]) ResultCount

func (s *Spy[T, R]) ResultCount() int

Jump to

Keyboard shortcuts

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