mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-26 23:16:48 +00:00
* golangci-lint: Enable usetesting and unused linters * tests: Improve assertions in various test cases for clarity and accuracy * tests: Enhance error assertions in TestExecuteStrategyFromFile for improved clarity * tests: Update assertions for improved clarity and accuracy * tests: Replace assert with require for task count checks * config/versions/v7: Replace context.Background() with t.Context() * Bithumb: Centralise and consoliate testPair, relax UpdateTickers check with some glorious Doom Eternal music * Bithumb: Use UpdatePairsOnce and update remaining pair string * Bithumb: Add UpdatePairsOnce to TestUpdateTickers
38 lines
1002 B
Go
38 lines
1002 B
Go
package v2_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
v2 "github.com/thrasher-corp/gocryptotrader/config/versions/v2"
|
|
)
|
|
|
|
func TestUpgradeExchange(t *testing.T) {
|
|
t.Parallel()
|
|
for _, tt := range [][]string{
|
|
{"GDAX", "CoinbasePro"},
|
|
{"Kraken", "Kraken"},
|
|
{"CoinbasePro", "CoinbasePro"},
|
|
} {
|
|
out, err := new(v2.Version).UpgradeExchange(t.Context(), []byte(`{"name":"`+tt[0]+`"}`))
|
|
require.NoError(t, err)
|
|
require.NotEmpty(t, out)
|
|
assert.Equalf(t, `{"name":"`+tt[1]+`"}`, string(out), "Test exchange name %s", tt[0])
|
|
}
|
|
}
|
|
|
|
func TestDowngradeExchange(t *testing.T) {
|
|
t.Parallel()
|
|
for _, tt := range [][]string{
|
|
{"GDAX", "GDAX"},
|
|
{"Kraken", "Kraken"},
|
|
{"CoinbasePro", "GDAX"},
|
|
} {
|
|
out, err := new(v2.Version).DowngradeExchange(t.Context(), []byte(`{"name":"`+tt[0]+`"}`))
|
|
require.NoError(t, err)
|
|
require.NotEmpty(t, out)
|
|
assert.Equalf(t, `{"name":"`+tt[1]+`"}`, string(out), "Test exchange name %s", tt[0])
|
|
}
|
|
}
|