Skip to content

Commit

Permalink
chore: do not warn on ignored denom
Browse files Browse the repository at this point in the history
  • Loading branch information
freak12techno committed Jul 10, 2024
1 parent 1f51763 commit 18be41a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/config/denom_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (d *DenomInfo) Validate() error {

func (d *DenomInfo) DisplayWarnings(chain *Chain) []Warning {
warnings := []Warning{}
if d.CoingeckoCurrency == "" {
if d.CoingeckoCurrency == "" && !d.Ignore.Bool {
warnings = append(warnings, Warning{
Message: "Currency code not set, not fetching exchange rate.",
Labels: map[string]string{
Expand Down
18 changes: 18 additions & 0 deletions pkg/config/denom_info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package config
import (
"testing"

"github.com/guregu/null/v5"

"github.com/stretchr/testify/assert"

"github.com/stretchr/testify/require"
Expand All @@ -24,6 +26,14 @@ func TestDenomInfoValidateNoDisplayDenom(t *testing.T) {
require.Error(t, err)
}

func TestDenomInfoValidateNoDisplayDenomIgnored(t *testing.T) {
t.Parallel()

denom := DenomInfo{Denom: "ustake", Ignore: null.BoolFrom(true)}
err := denom.Validate()
require.NoError(t, err)
}

func TestDenomInfoValidateValid(t *testing.T) {
t.Parallel()

Expand All @@ -40,6 +50,14 @@ func TestDenomInfoDisplayWarningNoCoingecko(t *testing.T) {
assert.NotEmpty(t, warnings)
}

func TestDenomInfoDisplayWarningNoCoingeckoDisabled(t *testing.T) {
t.Parallel()

denom := DenomInfo{Denom: "ustake", DisplayDenom: "stake", Ignore: null.BoolFrom(true)}
warnings := denom.DisplayWarnings(&Chain{Name: "test"})
assert.Empty(t, warnings)
}

func TestDenomInfoDisplayWarningEmpty(t *testing.T) {
t.Parallel()

Expand Down

0 comments on commit 18be41a

Please sign in to comment.