mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 15:09:42 +00:00
engine: Fix nil pointer panic in TestGetHistoricCandles (#1976)
* Initial plan * Fix nil pointer panic in TestGetHistoricCandles by adding early returns Co-authored-by: thrasher- <4685270+thrasher-@users.noreply.github.com> * Replace error handling with require.NoError in TestGetHistoricCandles Co-authored-by: gbjk <86617+gbjk@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: thrasher- <4685270+thrasher-@users.noreply.github.com> Co-authored-by: gbjk <86617+gbjk@users.noreply.github.com>
This commit is contained in:
@@ -821,9 +821,7 @@ func TestGetHistoricCandles(t *testing.T) {
|
||||
AssetType: asset.Spot.String(),
|
||||
TimeInterval: int64(kline.OneHour.Duration()),
|
||||
})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
require.NoError(t, err)
|
||||
if len(results.Candle) == 0 {
|
||||
t.Error("expected results")
|
||||
}
|
||||
@@ -842,9 +840,7 @@ func TestGetHistoricCandles(t *testing.T) {
|
||||
Sync: true,
|
||||
ExRequest: true,
|
||||
})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
require.NoError(t, err)
|
||||
if len(results.Candle) == 0 {
|
||||
t.Error("expected results")
|
||||
}
|
||||
@@ -862,9 +858,7 @@ func TestGetHistoricCandles(t *testing.T) {
|
||||
TimeInterval: int64(kline.OneHour.Duration()),
|
||||
UseDb: true,
|
||||
})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
require.NoError(t, err)
|
||||
if len(results.Candle) == 0 {
|
||||
t.Error("expected results")
|
||||
}
|
||||
@@ -896,9 +890,7 @@ func TestGetHistoricCandles(t *testing.T) {
|
||||
UseDb: true,
|
||||
FillMissingWithTrades: true,
|
||||
})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
require.NoError(t, err)
|
||||
if results.Candle[len(results.Candle)-1].Close != 1337 {
|
||||
t.Error("expected fancy new candle based off fancy new trade data")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user