Files
gocryptotrader/exchanges/binance/binance_mock_test.go
Gareth Kirwan 93c2d0122b Test: Internal exchange coverage (#1525)
* Test: Internal exchange coverage

* Tests: Rename exchange.TestInstance to Setup

This package function is either going to be imported and used as just exchange.Setup,
or more likely testexch.Setup.
This removes the Stutter of having
internal/testing/exchange.TestInstance which is implicit given the
package path
2024-05-07 15:14:02 +10:00

39 lines
699 B
Go

//go:build !mock_test_off
// This will build if build tag mock_test_off is not parsed and will try to mock
// all tests in _test.go
package binance
import (
"context"
"log"
"os"
"testing"
testexch "github.com/thrasher-corp/gocryptotrader/internal/testing/exchange"
)
var mockTests = true
func TestMain(m *testing.M) {
if useTestNet {
log.Fatal("cannot use testnet with mock tests")
}
b = new(Binance)
if err := testexch.Setup(b); err != nil {
log.Fatal(err)
}
if err := testexch.MockHTTPInstance(b); err != nil {
log.Fatal(err)
}
b.setupOrderbookManager()
if err := b.UpdateTradablePairs(context.Background(), true); err != nil {
log.Fatal(err)
}
os.Exit(m.Run())
}