From a37e6c7c398abd5349e239973730e1ea2f384a51 Mon Sep 17 00:00:00 2001 From: Gareth Kirwan Date: Mon, 6 Nov 2023 11:00:10 +0700 Subject: [PATCH] fixup! Websockets: Add Subscription configuration --- exchanges/exchange_test.go | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/exchanges/exchange_test.go b/exchanges/exchange_test.go index 2ebe388e33d..8ddc08f2782 100644 --- a/exchanges/exchange_test.go +++ b/exchanges/exchange_test.go @@ -7,6 +7,7 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" "github.com/thrasher-corp/gocryptotrader/common" "github.com/thrasher-corp/gocryptotrader/common/convert" "github.com/thrasher-corp/gocryptotrader/config" @@ -3221,9 +3222,24 @@ func TestIsPairEnabled(t *testing.T) { func TestSetEnabledSubscriptions(t *testing.T) { t.Parallel() - b := Base{Name: "test"} - - _ = b + b := Base{ + Config: &config.Exchange{ + Features: &config.FeaturesConfig{}, + }, + } + subs := []subscription.Subscription{ + {Channel: subscription.CandlesChannel, Interval: kline.OneDay}, + } + b.Features.Enabled.Subscriptions = subs + b.SetEnabledSubscriptions() + assert.ElementsMatch(t, subs, b.Config.Features.Enabled.Subscriptions, "Config Enabled Subscriptions should be updated") + assert.ElementsMatch(t, subs, b.Features.Enabled.Subscriptions, "Enabled Subscriptions should be the same") - // + subs = []subscription.Subscription{ + {Channel: subscription.OrderbookChannel, Interval: kline.OneDay}, + } + b.Config.Features.Enabled.Subscriptions = subs + b.SetEnabledSubscriptions() + assert.ElementsMatch(t, subs, b.Features.Enabled.Subscriptions, "Enabled Subscriptions should be updated from Config") + assert.ElementsMatch(t, subs, b.Config.Features.Enabled.Subscriptions, "Config Enabled Subscriptions should be the same") }