tests

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const MockInvoice = "" /* 263-byte string literal not displayed */
View Source
const MockPaymentHash = "320c2c5a1492ccfd5bc7aa4ad9b657d6aaec3cfcc0d1d98413a29af4ac772ccf" // for the above invoice
View Source
const MockPaymentHash500 = "be8ad5d0b82071d538dcd160e3a3af444bd890de68388a4d771ba23c01096f2a"

for the invoice: lnbcrt5u1pjuywzppp5h69dt59cypca2wxu69sw8ga0g39a3yx7dqug5nthrw3rcqgfdu4qdqqcqzzsxqyz5vqsp5gzlpzszyj2k30qmpme7jsfzr24wqlvt9xdmr7ay34lfelz050krs9qyyssq038x07nh8yuv8hdpjh5y8kqp7zcd62ql9na9xh7pla44htjyy02sz23q7qm2tza6ct4ypljk54w9k9qsrsu95usk8ce726ytep6vhhsq9mhf9a

Variables

View Source
var MockNodeInfo = lnclient.NodeInfo{
	Alias:       "bob",
	Color:       "#3399FF",
	Pubkey:      "123pubkey",
	Network:     "testnet",
	BlockHeight: 12,
	BlockHash:   "123blockhash",
}
View Source
var MockTime = time.Unix(1693876963, 0)
View Source
var MockTimeUnix = MockTime.Unix()
View Source
var MockTransaction = &MockTransactions[0]
View Source
var MockTransactions = []lnclient.Transaction{
	{
		Type:            "incoming",
		Invoice:         MockInvoice,
		Description:     "mock invoice 1",
		DescriptionHash: "hash1",
		Preimage:        "preimage1",
		PaymentHash:     "payment_hash_1",
		Amount:          1000,
		FeesPaid:        50,
		SettledAt:       &MockTimeUnix,
		Metadata: map[string]interface{}{
			"key1": "value1",
			"key2": 42,
		},
	},
	{
		Type:            "incoming",
		Invoice:         MockInvoice,
		Description:     "mock invoice 2",
		DescriptionHash: "hash2",
		Preimage:        "preimage2",
		PaymentHash:     "payment_hash_2",
		Amount:          2000,
		FeesPaid:        75,
		SettledAt:       &MockTimeUnix,
	},
}

Functions

func CreateApp

func CreateApp(svc *TestService) (app *db.App, ss []byte, err error)

func RemoveTestService

func RemoveTestService()

Types

type MockLn

type MockLn struct {
}

func NewMockLn

func NewMockLn() (*MockLn, error)

func (*MockLn) CloseChannel

func (mln *MockLn) CloseChannel(ctx context.Context, closeChannelRequest *lnclient.CloseChannelRequest) (*lnclient.CloseChannelResponse, error)

func (*MockLn) ConnectPeer

func (mln *MockLn) ConnectPeer(ctx context.Context, connectPeerRequest *lnclient.ConnectPeerRequest) error

func (*MockLn) DisconnectPeer

func (mln *MockLn) DisconnectPeer(ctx context.Context, peerId string) error

func (*MockLn) GetBalance

func (mln *MockLn) GetBalance(ctx context.Context) (balance int64, err error)

func (*MockLn) GetBalances

func (mln *MockLn) GetBalances(ctx context.Context) (*lnclient.BalancesResponse, error)

func (*MockLn) GetInfo

func (mln *MockLn) GetInfo(ctx context.Context) (info *lnclient.NodeInfo, err error)

func (*MockLn) GetLogOutput

func (mln *MockLn) GetLogOutput(ctx context.Context, maxLen int) ([]byte, error)

func (*MockLn) GetNetworkGraph

func (mln *MockLn) GetNetworkGraph(nodeIds []string) (lnclient.NetworkGraphResponse, error)

func (*MockLn) GetNewOnchainAddress

func (mln *MockLn) GetNewOnchainAddress(ctx context.Context) (string, error)

func (*MockLn) GetNodeConnectionInfo

func (mln *MockLn) GetNodeConnectionInfo(ctx context.Context) (nodeConnectionInfo *lnclient.NodeConnectionInfo, err error)

func (*MockLn) GetNodeStatus

func (mln *MockLn) GetNodeStatus(ctx context.Context) (nodeStatus *lnclient.NodeStatus, err error)

func (*MockLn) GetOnchainBalance

func (mln *MockLn) GetOnchainBalance(ctx context.Context) (*lnclient.OnchainBalanceResponse, error)

func (*MockLn) GetStorageDir

func (mln *MockLn) GetStorageDir() (string, error)

func (*MockLn) GetSupportedNIP47Methods

func (mln *MockLn) GetSupportedNIP47Methods() []string

func (*MockLn) GetSupportedNIP47NotificationTypes

func (mln *MockLn) GetSupportedNIP47NotificationTypes() []string

func (*MockLn) ListChannels

func (mln *MockLn) ListChannels(ctx context.Context) (channels []lnclient.Channel, err error)

func (*MockLn) ListPeers

func (mln *MockLn) ListPeers(ctx context.Context) ([]lnclient.PeerDetails, error)

func (*MockLn) ListTransactions

func (mln *MockLn) ListTransactions(ctx context.Context, from, until, limit, offset uint64, unpaid bool, invoiceType string) (invoices []lnclient.Transaction, err error)

func (*MockLn) LookupInvoice

func (mln *MockLn) LookupInvoice(ctx context.Context, paymentHash string) (transaction *lnclient.Transaction, err error)

func (*MockLn) MakeInvoice

func (mln *MockLn) MakeInvoice(ctx context.Context, amount int64, description string, descriptionHash string, expiry int64) (transaction *lnclient.Transaction, err error)

func (*MockLn) OpenChannel

func (mln *MockLn) OpenChannel(ctx context.Context, openChannelRequest *lnclient.OpenChannelRequest) (*lnclient.OpenChannelResponse, error)

func (*MockLn) RedeemOnchainFunds

func (mln *MockLn) RedeemOnchainFunds(ctx context.Context, toAddress string) (txId string, err error)

func (*MockLn) ResetRouter

func (mln *MockLn) ResetRouter(key string) error

func (*MockLn) SendKeysend

func (mln *MockLn) SendKeysend(ctx context.Context, amount uint64, destination, preimage string, custom_records []lnclient.TLVRecord) (preImage string, err error)

func (*MockLn) SendPaymentProbes

func (mln *MockLn) SendPaymentProbes(ctx context.Context, invoice string) error

func (*MockLn) SendPaymentSync

func (mln *MockLn) SendPaymentSync(ctx context.Context, payReq string) (*lnclient.PayInvoiceResponse, error)

func (*MockLn) SendSpontaneousPaymentProbes

func (mln *MockLn) SendSpontaneousPaymentProbes(ctx context.Context, amountMsat uint64, nodeId string) error

func (*MockLn) Shutdown

func (mln *MockLn) Shutdown() error

func (*MockLn) SignMessage

func (mln *MockLn) SignMessage(ctx context.Context, message string) (string, error)

func (*MockLn) UpdateChannel

func (mln *MockLn) UpdateChannel(ctx context.Context, updateChannelRequest *lnclient.UpdateChannelRequest) error

func (*MockLn) UpdateLastWalletSyncRequest

func (mln *MockLn) UpdateLastWalletSyncRequest()

type TestService

type TestService struct {
	Keys           keys.Keys
	Cfg            config.Config
	LNClient       lnclient.LNClient
	EventPublisher events.EventPublisher
	DB             *gorm.DB
}

func CreateTestService

func CreateTestService() (svc *TestService, err error)

Jump to

Keyboard shortcuts

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