mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-23 15:10:15 +00:00
* stream/buffer: remove publish period for for signalling change through data handler * Add config upgrade and downgrade * linter: fix * GK: nits * Update config/versions/v3.go Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io> * Update config/versions/v3.go Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io> * Update config/versions/v3.go Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io> * Update config/versions/v3.go Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io> * Update config/versions/v3.go Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io> * config: fix up commited suggestion --------- Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io> Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
43 lines
1.4 KiB
Go
43 lines
1.4 KiB
Go
package versions
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestVersion3UpgradeExchange(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
got, err := (&Version3{}).UpgradeExchange(context.Background(), nil)
|
|
require.NoError(t, err)
|
|
require.Nil(t, got)
|
|
|
|
payload := []byte(`{"orderbook": {"verificationBypass": false,"websocketBufferLimit": 5,"websocketBufferEnabled": false,"publishPeriod": 10000000000}}`)
|
|
expected := []byte(`{"orderbook": {"verificationBypass": false,"websocketBufferLimit": 5,"websocketBufferEnabled": false}}`)
|
|
got, err = (&Version3{}).UpgradeExchange(context.Background(), payload)
|
|
require.NoError(t, err)
|
|
require.Equal(t, expected, got)
|
|
}
|
|
|
|
func TestVersion3DowngradeExchange(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
got, err := (&Version3{}).DowngradeExchange(context.Background(), nil)
|
|
require.NoError(t, err)
|
|
require.Nil(t, got)
|
|
|
|
payload := []byte(`{"orderbook": {"verificationBypass": false,"websocketBufferLimit": 5,"websocketBufferEnabled": false}}`)
|
|
expected := []byte(`{"orderbook": {"verificationBypass": false,"websocketBufferLimit": 5,"websocketBufferEnabled": false,"publishPeriod":10000000000}}`)
|
|
got, err = (&Version3{}).DowngradeExchange(context.Background(), payload)
|
|
require.NoError(t, err)
|
|
require.Equal(t, expected, got)
|
|
}
|
|
|
|
func TestVersion3Exchanges(t *testing.T) {
|
|
t.Parallel()
|
|
assert := require.New(t)
|
|
assert.Equal([]string{"*"}, (&Version3{}).Exchanges())
|
|
}
|