mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-01 18:27:43 +02:00
This commit moves most of the code into its own package. It is the smallest code move possible without moving import cycles and keeping the changes to the code base as small as possible during refactor.
24 lines
510 B
Go
24 lines
510 B
Go
package paymentsdb
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/lightningnetwork/lnd/kvdb"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
// NewTestDB is a helper function that creates an BBolt database for testing.
|
|
func NewTestDB(t *testing.T, opts ...OptionModifier) *KVPaymentsDB {
|
|
backend, backendCleanup, err := kvdb.GetTestBackend(
|
|
t.TempDir(), "kvPaymentDB",
|
|
)
|
|
require.NoError(t, err)
|
|
|
|
t.Cleanup(backendCleanup)
|
|
|
|
paymentDB, err := NewKVPaymentsDB(backend, opts...)
|
|
require.NoError(t, err)
|
|
|
|
return paymentDB
|
|
}
|