mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-01 23:16:51 +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:
@@ -1090,8 +1090,8 @@ func TestGetCurrencyTradeURL(t *testing.T) {
|
||||
testexch.UpdatePairsOnce(t, b)
|
||||
for _, a := range b.GetAssetTypes(false) {
|
||||
pairs, err := b.CurrencyPairs.GetPairs(a, false)
|
||||
require.NoError(t, err, "cannot get pairs for %s", a)
|
||||
require.NotEmpty(t, pairs, "no pairs for %s", a)
|
||||
require.NoErrorf(t, err, "cannot get pairs for %s", a)
|
||||
require.NotEmptyf(t, pairs, "no pairs for %s", a)
|
||||
resp, err := b.GetCurrencyTradeURL(t.Context(), a, pairs[0])
|
||||
require.NoError(t, err)
|
||||
assert.NotEmpty(t, resp)
|
||||
@@ -1143,12 +1143,12 @@ func TestSubscribe(t *testing.T) {
|
||||
require.NoError(t, err, "generateSubscriptions must not error")
|
||||
testexch.SetupWs(t, b)
|
||||
err = b.Subscribe(subs)
|
||||
require.NoError(t, err, "Subscribe should not error")
|
||||
require.NoError(t, err, "Subscribe must not error")
|
||||
for _, s := range subs {
|
||||
assert.Equalf(t, subscription.SubscribedState, s.State(), "%s state should be subscribed", s.QualifiedChannel)
|
||||
}
|
||||
err = b.Unsubscribe(subs)
|
||||
require.NoError(t, err, "Unsubscribe should not error")
|
||||
require.NoError(t, err, "Unsubscribe must not error")
|
||||
for _, s := range subs {
|
||||
assert.Equalf(t, subscription.UnsubscribedState, s.State(), "%s state should be unsusbscribed", s.QualifiedChannel)
|
||||
}
|
||||
|
||||
@@ -52,12 +52,12 @@ func (b *Bitmex) SetDefaults() {
|
||||
ps.RequestFormat.Delimiter = currency.UnderscoreDelimiter
|
||||
}
|
||||
if err := b.SetAssetPairStore(a, ps); err != nil {
|
||||
log.Errorf(log.ExchangeSys, "%s error storing `%s` default asset formats: %s", b.Name, a, err)
|
||||
log.Errorf(log.ExchangeSys, "%s error storing %q default asset formats: %s", b.Name, a, err)
|
||||
}
|
||||
}
|
||||
|
||||
if err := b.DisableAssetWebsocketSupport(asset.Index); err != nil {
|
||||
log.Errorf(log.ExchangeSys, "%s error disabling `%s` asset type websocket support: %s", b.Name, asset.Index, err)
|
||||
log.Errorf(log.ExchangeSys, "%s error disabling %q asset type websocket support: %s", b.Name, asset.Index, err)
|
||||
}
|
||||
|
||||
b.Features = exchange.Features{
|
||||
|
||||
Reference in New Issue
Block a user