From b46a993dcb32148933252ebd4ce3429e63b3d056 Mon Sep 17 00:00:00 2001 From: Gareth Kirwan Date: Wed, 14 Aug 2024 12:34:42 +0700 Subject: [PATCH] Kraken: Add TestEnforceStandardChannelNames --- exchanges/kraken/kraken_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/exchanges/kraken/kraken_test.go b/exchanges/kraken/kraken_test.go index 1518d5d5700..106f4e16cc4 100644 --- a/exchanges/kraken/kraken_test.go +++ b/exchanges/kraken/kraken_test.go @@ -1706,3 +1706,16 @@ func TestErrorResponse(t *testing.T) { }) } } + +func TestEnforceStandardChannelNames(t *testing.T) { + for _, n := range []string{ + krakenWsSpread, krakenWsTicker, subscription.TickerChannel, subscription.OrderbookChannel, subscription.CandlesChannel, + subscription.AllTradesChannel, subscription.MyTradesChannel, subscription.MyOrdersChannel, + } { + assert.NoError(t, enforceStandardChannelNames(&subscription.Subscription{Channel: n}), "Standard channel names and bespoke names should not error") + } + for _, n := range []string{krakenWsOrderbook, krakenWsOHLC, krakenWsTrade, krakenWsOwnTrades, krakenWsOpenOrders, krakenWsOrderbook + "-5"} { + err := enforceStandardChannelNames(&subscription.Subscription{Channel: n}) + assert.ErrorIsf(t, err, subscription.ErrPrivateChannelName, "Private channel names should not be allowed for %s", n) + } +}