mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-02 07:26:53 +00:00
Tests: Abstract UpdatePairsOnce (#1503)
This commit is contained in:
@@ -8,7 +8,6 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -28,6 +27,7 @@ import (
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/order"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/orderbook"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/sharedtestvalues"
|
||||
testexch "github.com/thrasher-corp/gocryptotrader/internal/testing/exchange"
|
||||
"github.com/thrasher-corp/gocryptotrader/portfolio/withdraw"
|
||||
)
|
||||
|
||||
@@ -207,7 +207,7 @@ func TestGetBlockTrade(t *testing.T) {
|
||||
assert.WithinRange(t, trade.Timestamp.Time(), time.Now().Add(time.Hour*-24*7), time.Now(), "Timestamp should be within last 7 days")
|
||||
}
|
||||
|
||||
updatePairsOnce(t)
|
||||
testexch.UpdatePairsOnce(t, ok)
|
||||
|
||||
pairs, err := ok.GetAvailablePairs(asset.Options)
|
||||
assert.NoError(t, err, "GetAvailablePairs should not error")
|
||||
@@ -1920,17 +1920,7 @@ func TestFetchTradablePairs(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 := ok.UpdateTradablePairs(context.Background(), true)
|
||||
assert.NoError(tb, err, "UpdateTradablePairs should not error")
|
||||
})
|
||||
testexch.UpdatePairsOnce(t, ok)
|
||||
}
|
||||
|
||||
func TestUpdateOrderExecutionLimits(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user