mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
Include https://github.com/lightninglabs/lndclient/pull/280 multi: migrate to btcd v2 modules + add WalletKit.SubmitPackage Migrate Loop imports and update Aperture and Taproot Assets to compatible revisions so this commit remains green on its own.
51 lines
1.2 KiB
Go
51 lines
1.2 KiB
Go
package loopd
|
|
|
|
import (
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/btcsuite/btcd/btcutil/v2"
|
|
"github.com/lightninglabs/loop/assets"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
// TestValidateTapdMacaroonPath tests that validation updates the default tapd
|
|
// macaroon path for the configured network without changing an explicit path.
|
|
func TestValidateTapdMacaroonPath(t *testing.T) {
|
|
customPath := filepath.Join(t.TempDir(), "custom.macaroon")
|
|
defaultConfig := assets.DefaultTapdConfig()
|
|
regtestConfig := assets.DefaultTapdConfigForNetwork(
|
|
btcutil.AppDataDir("tapd", false), "regtest",
|
|
)
|
|
|
|
tests := []struct {
|
|
name string
|
|
macaroonPath string
|
|
expectedPath string
|
|
}{
|
|
{
|
|
name: "default path",
|
|
macaroonPath: defaultConfig.MacaroonPath,
|
|
expectedPath: regtestConfig.MacaroonPath,
|
|
},
|
|
{
|
|
name: "explicit path",
|
|
macaroonPath: customPath,
|
|
expectedPath: customPath,
|
|
},
|
|
}
|
|
|
|
for _, test := range tests {
|
|
t.Run(test.name, func(t *testing.T) {
|
|
cfg := DefaultConfig()
|
|
cfg.Network = "regtest"
|
|
cfg.LoopDir = t.TempDir()
|
|
cfg.Tapd.MacaroonPath = test.macaroonPath
|
|
|
|
require.NoError(t, Validate(&cfg))
|
|
require.Equal(
|
|
t, test.expectedPath, cfg.Tapd.MacaroonPath,
|
|
)
|
|
})
|
|
}
|
|
}
|