mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 23:16:45 +00:00
* Config: Move config versions to separate pacakges * Config: Move version tests to blackbox texts * Config: Protect registerVersion from overflow * Config: Protect against version already registered
27 lines
621 B
Go
27 lines
621 B
Go
package v0_test
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
v0 "github.com/thrasher-corp/gocryptotrader/config/versions/v0"
|
|
)
|
|
|
|
func TestUpgradeConfig(t *testing.T) {
|
|
t.Parallel()
|
|
in := []byte(`{"untouched":true}`)
|
|
out, err := new(v0.Version).UpgradeConfig(context.Background(), in)
|
|
require.NoError(t, err)
|
|
assert.Equal(t, in, out)
|
|
}
|
|
|
|
func TestDowngradeConfig(t *testing.T) {
|
|
t.Parallel()
|
|
in := []byte(`{"untouched":true}`)
|
|
out, err := new(v0.Version).DowngradeConfig(context.Background(), in)
|
|
require.NoError(t, err)
|
|
assert.Equal(t, in, out)
|
|
}
|