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,7 +1,6 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
@@ -1129,9 +1128,7 @@ func TestGetExchangeConfig(t *testing.T) {
|
||||
err.Error())
|
||||
}
|
||||
_, err = cfg.GetExchangeConfig("Testy")
|
||||
if !errors.Is(err, ErrExchangeNotFound) {
|
||||
t.Errorf("received '%v' expected '%v'", err, ErrExchangeNotFound)
|
||||
}
|
||||
assert.ErrorIs(t, err, ErrExchangeNotFound)
|
||||
}
|
||||
|
||||
func TestGetForexProviders(t *testing.T) {
|
||||
@@ -2006,9 +2003,7 @@ func TestMigrateConfig(t *testing.T) {
|
||||
|
||||
func TestExchangeConfigValidate(t *testing.T) {
|
||||
err := (*Exchange)(nil).Validate()
|
||||
if !errors.Is(err, errExchangeConfigIsNil) {
|
||||
t.Fatalf("received: '%v' but expected: '%v'", err, errExchangeConfigIsNil)
|
||||
}
|
||||
require.ErrorIs(t, err, errExchangeConfigIsNil)
|
||||
|
||||
err = (&Exchange{}).Validate()
|
||||
require.NoError(t, err)
|
||||
|
||||
Reference in New Issue
Block a user