Skip to content

Commit

Permalink
fixup! Websockets: Add Subscription configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
gbjk committed Nov 6, 2023
1 parent 73b6a83 commit a37e6c7
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions exchanges/exchange_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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")
}

0 comments on commit a37e6c7

Please sign in to comment.