mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-03 23:16:53 +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 withdraw
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/thrasher-corp/gocryptotrader/common"
|
||||
"github.com/thrasher-corp/gocryptotrader/currency"
|
||||
"github.com/thrasher-corp/gocryptotrader/database"
|
||||
@@ -159,11 +160,7 @@ func withdrawHelper(t *testing.T) {
|
||||
seedWithdrawData()
|
||||
|
||||
_, err := GetEventByUUID(withdraw.DryRunID.String())
|
||||
if err != nil {
|
||||
if !errors.Is(err, common.ErrNoResults) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
require.ErrorIs(t, err, common.ErrNoResults)
|
||||
|
||||
v, err := GetEventsByExchange(testExchanges[0].Name, 10)
|
||||
if err != nil {
|
||||
@@ -182,9 +179,7 @@ func withdrawHelper(t *testing.T) {
|
||||
if len(v) > 0 {
|
||||
_, err = GetEventByUUID(v[0].ID.String())
|
||||
if err != nil {
|
||||
if !errors.Is(err, common.ErrNoResults) {
|
||||
t.Error(err)
|
||||
}
|
||||
assert.ErrorIs(t, err, common.ErrNoResults)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user