diff --git a/exchanges/stream/websocket_test.go b/exchanges/stream/websocket_test.go index f868bcddbf2..f4ac398085e 100644 --- a/exchanges/stream/websocket_test.go +++ b/exchanges/stream/websocket_test.go @@ -552,7 +552,7 @@ func TestGetSubscription(t *testing.T) { t.Parallel() assert.Nil(t, (*Websocket).GetSubscription(nil, "imaginary"), "GetSubscription on a nil Websocket should return nil") assert.Nil(t, (&Websocket{}).GetSubscription("empty"), "GetSubscription on a Websocket with no sub store should return nil") - w := New() + w := NewWebsocket() assert.Nil(t, w.GetSubscription(nil), "GetSubscription with a nil key should return nil") s := &subscription.Subscription{Key: 42, Channel: "hello3"} w.AddSubscription(s) @@ -564,7 +564,7 @@ func TestGetSubscriptions(t *testing.T) { t.Parallel() assert.Nil(t, (*Websocket).GetSubscriptions(nil), "GetSubscription on a nil Websocket should return nil") assert.Nil(t, (&Websocket{}).GetSubscriptions(), "GetSubscription on a Websocket with no sub store should return nil") - w := New() + w := NewWebsocket() w.AddSubscriptions(subscription.List{ {Key: 42, Channel: "hello3"}, {Key: 45, Channel: "hello4"}, @@ -919,7 +919,7 @@ func TestGetChannelDifference(t *testing.T) { s.SetState(subscription.SubscribedState) } - w.AddSubscriptions(subs) + web.AddSubscriptions(subs) flushedSubs := subscription.List{ {Channel: "Test2"}, @@ -1028,7 +1028,7 @@ func TestFlushChannels(t *testing.T) { w.GenerateSubs = func() (subscription.List, error) { return subscription.List{{Channel: "test"}}, nil } - err = web.FlushChannels() + err = w.FlushChannels() require.NoError(t, err, "Flush Channels must not error") w.features.FullPayloadSubscribe = true @@ -1040,36 +1040,28 @@ func TestFlushChannels(t *testing.T) { err = w.FlushChannels() // No subs to sub assert.NoError(t, err, "Flush Channels should not error") - web.GenerateSubs = newgen.generateSubs - subs, err := web.GenerateSubs() + w.GenerateSubs = newgen.generateSubs + subs, err := w.GenerateSubs() require.NoError(t, err, "GenerateSubs must not error") for _, s := range subs { s.SetState(subscription.SubscribedState) } - web.AddSubscriptions(subs) - err = web.FlushChannels() - if err != nil { - t.Fatal(err) - } - web.features.FullPayloadSubscribe = false - web.features.Subscribe = true - - w.AddSuccessfulSubscriptions(subs...) + w.AddSubscriptions(subs) err = w.FlushChannels() assert.NoError(t, err, "FlushChannels should not error") w.features.FullPayloadSubscribe = false w.features.Subscribe = true - web.GenerateSubs = newgen.generateSubs - err = web.FlushChannels() + w.GenerateSubs = newgen.generateSubs + err = w.FlushChannels() assert.ErrorIs(t, err, errDastardlyReason, "FlushChannels should error correctly") - web.subscriptions = subscription.NewStore() - web.subscriptions.Add(&subscription.Subscription{ + w.subscriptions = subscription.NewStore() + w.subscriptions.Add(&subscription.Subscription{ Key: 41, Channel: "match channel", Pairs: currency.Pairs{currency.NewPair(currency.BTC, currency.AUD)}, }) - web.subscriptions.Add(&subscription.Subscription{ + w.subscriptions.Add(&subscription.Subscription{ Key: 42, Channel: "unsub channel", Pairs: currency.Pairs{currency.NewPair(currency.THETA, currency.USDT)}, @@ -1078,9 +1070,6 @@ func TestFlushChannels(t *testing.T) { err = w.FlushChannels() assert.NoError(t, err, "FlushChannels should not error") - err = w.FlushChannels() - assert.NoError(t, err, "FlushChannels should not error") - w.setState(connected) w.features.Unsubscribe = true err = w.FlushChannels()