Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: do not warn on ignored denom #74

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading