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:
Adrian Gallagher
2025-06-10 16:29:57 +10:00
committed by GitHub
parent 122ab2f849
commit 19b8957f3f
109 changed files with 2485 additions and 5670 deletions

View File

@@ -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-- {