mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-03 07:26:45 +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,7 +1,6 @@
|
||||
package asset
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"slices"
|
||||
"testing"
|
||||
|
||||
@@ -125,9 +124,8 @@ func TestNew(t *testing.T) {
|
||||
t.Run("", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
returned, err := New(tt.Input)
|
||||
if !errors.Is(err, tt.Error) {
|
||||
t.Fatalf("received: '%v' but expected: '%v'", err, tt.Error)
|
||||
}
|
||||
require.ErrorIs(t, err, tt.Error)
|
||||
|
||||
if returned != tt.Expected {
|
||||
t.Fatalf("received: '%v' but expected: '%v'", returned, tt.Expected)
|
||||
}
|
||||
@@ -174,9 +172,7 @@ func TestUnmarshalMarshal(t *testing.T) {
|
||||
}
|
||||
|
||||
err = json.Unmarshal([]byte(`"confused"`), &spot)
|
||||
if !errors.Is(err, ErrNotSupported) {
|
||||
t.Fatalf("received: '%v' but expected: '%v'", err, ErrNotSupported)
|
||||
}
|
||||
require.ErrorIs(t, err, ErrNotSupported)
|
||||
|
||||
err = json.Unmarshal([]byte(`""`), &spot)
|
||||
require.NoError(t, err)
|
||||
|
||||
Reference in New Issue
Block a user