mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-08 07:26:48 +00:00
GHA: Add additional checks for common issues (#1922)
* GHA, tests: Add additional checks for common issues These checks include: - Ensuring that all testify funcs use their formatted variants (e.g., `assert.Equalf(t, expected, actual)` instead of `assert.Equal(t, expected, actual)`). - Replacing `%s` with %q - Enforcing consistent usage of should/must wording for testify assert/require messages * Add support for checking backticked string format specifiers and fix issues * tests: Fix error comparisons * tests: Replace errors.Is(err, nil) usage with testify and automate check * refactor: Rename ExtractPort to ExtractPortOrDefault * tests: Replace assert with require for error handling in multiple test files * tests: Replace assert with require for error handling and improve assertions in data tests * tests: Fix typo in assertion message for StreamVol test * OKX: Fix GetOpenInterestAndVolumeStrike test with instrument selection and improved assertions * OKX: Revert intentional error check * Improve error message for expiry time check in GetOpenInterestAndVolumeStrike test
This commit is contained in:
@@ -76,7 +76,7 @@ func (s *Submit) Validate(requirements protocol.TradingRequirements, opt ...vali
|
||||
}
|
||||
|
||||
if !s.AssetType.IsValid() {
|
||||
return fmt.Errorf("'%s' %w", s.AssetType, asset.ErrNotSupported)
|
||||
return fmt.Errorf("%q %w", s.AssetType, asset.ErrNotSupported)
|
||||
}
|
||||
|
||||
if !IsValidOrderSubmissionSide(s.Side) {
|
||||
@@ -1076,7 +1076,7 @@ func StringToOrderSide(side string) (Side, error) {
|
||||
case AnySide.String():
|
||||
return AnySide, nil
|
||||
default:
|
||||
return UnknownSide, fmt.Errorf("'%s' %w", side, ErrSideIsInvalid)
|
||||
return UnknownSide, fmt.Errorf("%q %w", side, ErrSideIsInvalid)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1193,7 +1193,7 @@ func StringToOrderStatus(status string) (Status, error) {
|
||||
case STP.String(), "STP":
|
||||
return STP, nil
|
||||
default:
|
||||
return UnknownStatus, fmt.Errorf("'%s' %w", status, errUnrecognisedOrderStatus)
|
||||
return UnknownStatus, fmt.Errorf("%q %w", status, errUnrecognisedOrderStatus)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user