mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-31 15:10:42 +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:
@@ -158,7 +158,7 @@ func (b *Base) SetStream(s []Event) error {
|
||||
if s[x].GetExchange() != b.stream[0].GetExchange() ||
|
||||
s[x].GetAssetType() != b.stream[0].GetAssetType() ||
|
||||
!s[x].Pair().Equal(b.stream[0].Pair()) {
|
||||
return fmt.Errorf("%w cannot set base stream from %v %v %v to %v %v %v", errMisMatchedEvent, s[x].GetExchange(), s[x].GetAssetType(), s[x].Pair(), b.stream[0].GetExchange(), b.stream[0].GetAssetType(), b.stream[0].Pair())
|
||||
return fmt.Errorf("%w cannot set base stream from %v %v %v to %v %v %v", errMismatchedEvent, s[x].GetExchange(), s[x].GetAssetType(), s[x].Pair(), b.stream[0].GetExchange(), b.stream[0].GetAssetType(), b.stream[0].Pair())
|
||||
}
|
||||
}
|
||||
// due to the Next() function, we cannot take
|
||||
@@ -193,7 +193,7 @@ candles:
|
||||
if s[x].GetExchange() != b.stream[0].GetExchange() ||
|
||||
s[x].GetAssetType() != b.stream[0].GetAssetType() ||
|
||||
!s[x].Pair().Equal(b.stream[0].Pair()) {
|
||||
return fmt.Errorf("%w %v %v %v received %v %v %v", errMisMatchedEvent, b.stream[0].GetExchange(), b.stream[0].GetAssetType(), b.stream[0].Pair(), s[x].GetExchange(), s[x].GetAssetType(), s[x].Pair())
|
||||
return fmt.Errorf("%w %v %v %v received %v %v %v", errMismatchedEvent, b.stream[0].GetExchange(), b.stream[0].GetAssetType(), b.stream[0].Pair(), s[x].GetExchange(), s[x].GetAssetType(), s[x].Pair())
|
||||
}
|
||||
// todo change b.stream to map
|
||||
for y := len(b.stream) - 1; y >= 0; y-- {
|
||||
|
||||
Reference in New Issue
Block a user