mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-05 07:26:47 +00:00
codebase: Replace !errors.Is(err, target) with testify (#1931)
* tests: Replace !errors.Is(err, target) with testify equivalents * codebase: Manual !errors.Is(err, target) replacements * typo: Replace errMisMatchedEvent with errMismatchedEvent * tests: Enhance error messages for better output * tests: Refactor error assertions in various test cases to use require and improve clarity * misc linter: Fix assert should wording * tests: Simplify assertions in TestCreateSignals for clarity and conciseness * tests: Enhance assertion message in TestCreateSignals
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
package candle
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/thrasher-corp/gocryptotrader/currency"
|
||||
"github.com/thrasher-corp/gocryptotrader/database"
|
||||
"github.com/thrasher-corp/gocryptotrader/database/drivers"
|
||||
@@ -245,20 +246,11 @@ func TestSeries(t *testing.T) {
|
||||
}
|
||||
|
||||
_, err = Series("", "", "", 0, "", start, end)
|
||||
if !errors.Is(err, errInvalidInput) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
require.ErrorIs(t, err, errInvalidInput)
|
||||
|
||||
_, err = Series(testExchanges[0].Name,
|
||||
"BTC", "MOON",
|
||||
864000, "spot",
|
||||
start, end)
|
||||
if err != nil && !errors.Is(err, errInvalidInput) && !errors.Is(err, ErrNoCandleDataFound) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err = testhelpers.CloseDatabase(dbConn); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
_, err = Series(testExchanges[0].Name, "BTC", "MOON", 864000, "spot", start, end)
|
||||
require.ErrorIs(t, err, ErrNoCandleDataFound)
|
||||
assert.NoError(t, testhelpers.CloseDatabase(dbConn))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user