mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-30 15:10:40 +00:00
Tests: Abstract UpdatePairsOnce (#1503)
This commit is contained in:
@@ -7,7 +7,6 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
"strconv"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -27,6 +26,7 @@ import (
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/stream"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/subscription"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/ticker"
|
||||
testexch "github.com/thrasher-corp/gocryptotrader/internal/testing/exchange"
|
||||
"github.com/thrasher-corp/gocryptotrader/portfolio/withdraw"
|
||||
)
|
||||
|
||||
@@ -152,17 +152,7 @@ func TestGetPairs(t *testing.T) {
|
||||
|
||||
func TestUpdateTradablePairs(t *testing.T) {
|
||||
t.Parallel()
|
||||
updatePairsOnce(t)
|
||||
}
|
||||
|
||||
var updatePairsGuard sync.Once
|
||||
|
||||
func updatePairsOnce(tb testing.TB) {
|
||||
tb.Helper()
|
||||
updatePairsGuard.Do(func() {
|
||||
err := b.UpdateTradablePairs(context.Background(), true)
|
||||
assert.NoError(tb, err, "UpdateTradablePairs should not error")
|
||||
})
|
||||
testexch.UpdatePairsOnce(t, b)
|
||||
}
|
||||
|
||||
func TestUpdateOrderExecutionLimits(t *testing.T) {
|
||||
@@ -557,7 +547,7 @@ func TestUpdateTicker(t *testing.T) {
|
||||
func TestUpdateTickers(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
updatePairsOnce(t)
|
||||
testexch.UpdatePairsOnce(t, b)
|
||||
|
||||
assets := b.GetAssetTypes(false)
|
||||
for _, a := range assets {
|
||||
|
||||
Reference in New Issue
Block a user