Skip to content

Commit

Permalink
fix: uses lo.ToPtr to get pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
AntiTyping committed May 14, 2024
1 parent 6f9f932 commit 46f6f2f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions internal/fullnode/commands/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package commands
import (
"testing"

"github.com/samber/lo"
cosmosv1 "github.com/strangelove-ventures/cosmos-operator/api/v1"
"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -34,7 +35,7 @@ func TestDownloadGenesisCommand(t *testing.T) {

t.Run("download", func(t *testing.T) {
cfg := cosmosv1.ChainSpec{
GenesisURL: ptr("https://example.com/genesis.json"),
GenesisURL: lo.ToPtr("https://example.com/genesis.json"),
}
cmd, args := DownloadGenesisCommand(cfg)
require.Equal(t, "sh", cmd)
Expand All @@ -54,8 +55,8 @@ func TestDownloadGenesisCommand(t *testing.T) {
t.Run("custom", func(t *testing.T) {
cfg := cosmosv1.ChainSpec{
// Keeping this to assert that custom script takes precedence.
GenesisURL: ptr("https://example.com/genesis.json"),
GenesisScript: ptr("echo hi"),
GenesisURL: lo.ToPtr("https://example.com/genesis.json"),
GenesisScript: lo.ToPtr("echo hi"),
}
cmd, args := DownloadGenesisCommand(cfg)
require.Equal(t, "sh", cmd)
Expand Down
7 changes: 4 additions & 3 deletions internal/fullnode/commands/snapshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package commands
import (
"testing"

"github.com/samber/lo"
cosmosv1 "github.com/strangelove-ventures/cosmos-operator/api/v1"
"github.com/stretchr/testify/require"
)
Expand All @@ -19,7 +20,7 @@ fi`
)
t.Run("snapshot url", func(t *testing.T) {
var cfg cosmosv1.ChainSpec
cfg.SnapshotURL = ptr(testURL)
cfg.SnapshotURL = lo.ToPtr(testURL)

cmd, args := DownloadSnapshotCommand(cfg)
require.Equal(t, "sh", cmd)
Expand All @@ -38,8 +39,8 @@ fi`

t.Run("snapshot script", func(t *testing.T) {
var cfg cosmosv1.ChainSpec
cfg.SnapshotURL = ptr(testURL) // Asserts SnapshotScript takes precedence.
cfg.SnapshotScript = ptr("echo hello")
cfg.SnapshotURL = lo.ToPtr(testURL) // Asserts SnapshotScript takes precedence.
cfg.SnapshotScript = lo.ToPtr("echo hello")

_, args := DownloadSnapshotCommand(cfg)
require.Len(t, args, 2)
Expand Down

0 comments on commit 46f6f2f

Please sign in to comment.