From 3aae9ed6ea9a27a6bae1aabfd97591c5382ea849 Mon Sep 17 00:00:00 2001 From: clD11 <23483715+clD11@users.noreply.github.com> Date: Tue, 14 Sep 2021 01:11:30 +0100 Subject: [PATCH] fix broken precision value test (#729) --- plugins/ccxtExchange_test.go | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/plugins/ccxtExchange_test.go b/plugins/ccxtExchange_test.go index 531ffd9cf..dcfdb43d2 100644 --- a/plugins/ccxtExchange_test.go +++ b/plugins/ccxtExchange_test.go @@ -2,6 +2,7 @@ package plugins import ( "fmt" + "github.com/stretchr/testify/require" "log" "math" "strconv" @@ -572,8 +573,8 @@ func TestGetOrderConstraints_Ccxt_Precision(t *testing.T) { // }, { exchangeName: "binance", pair: &model.TradingPair{Base: model.XLM, Quote: model.USDT}, - wantPricePrecision: 5, - wantVolPrecision: 1, + wantPricePrecision: 4, + wantVolPrecision: 4, }, { exchangeName: "binance", pair: &model.TradingPair{Base: model.XLM, Quote: model.BTC}, @@ -588,27 +589,19 @@ func TestGetOrderConstraints_Ccxt_Precision(t *testing.T) { } for _, kase := range testCases { + + epf := getEsParamFactory(kase.exchangeName) + t.Run(kase.exchangeName, func(t *testing.T) { - testCcxtExchange, e := makeCcxtExchange( - kase.exchangeName, - nil, - []api.ExchangeAPIKey{emptyAPIKey}, - []api.ExchangeParam{emptyParams}, - []api.ExchangeHeader{}, - false, - getEsParamFactory(kase.exchangeName), - ) - if !assert.NoError(t, e) { - return - } + testCcxtExchange, e := makeCcxtExchange(kase.exchangeName, nil, []api.ExchangeAPIKey{emptyAPIKey}, + []api.ExchangeParam{emptyParams}, []api.ExchangeHeader{}, false, epf) + + require.NoError(t, e) result := testCcxtExchange.GetOrderConstraints(kase.pair) - if !assert.Equal(t, kase.wantPricePrecision, result.PricePrecision) { - return - } - if !assert.Equal(t, kase.wantVolPrecision, result.VolumePrecision) { - return - } + + assert.Equal(t, kase.wantPricePrecision, result.PricePrecision) + assert.Equal(t, kase.wantVolPrecision, result.VolumePrecision) }) } }