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

Subscriptions: Fix no enabled pairs for one asset #1792

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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 exchanges/subscription/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (l List) SetStates(state State) error {

func fillAssetPairs(ap assetPairs, a asset.Item, e IExchange) error {
p, err := e.GetEnabledPairs(a)
if err != nil {
if err != nil || len(p) == 0 {
return err
}
f, err := e.GetPairFormat(a, true)
Expand Down
11 changes: 11 additions & 0 deletions exchanges/subscription/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,17 @@ func TestAssetPairs(t *testing.T) {
}
}

// TestFillAssetPairs exercises AssetPairs handling with no enabled pairs
// All other code is covered under TestAssetPairs and TestExpandTemplates
func TestFillAssetPairs(t *testing.T) {
e := newMockEx()
e.pairs = currency.Pairs{}
ap := assetPairs{}
err := fillAssetPairs(ap, asset.Spot, e)
require.NoError(t, err, "fillAssetPairs must not error with no pairs enabled")
assert.Empty(t, ap, "fillAssetPairs should return an empty map with no pairs enabled")
}

func TestListClone(t *testing.T) {
t.Parallel()
l := List{{Channel: TickerChannel}, {Channel: OrderbookChannel}}
Expand Down
Loading