mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-02 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:
@@ -387,7 +387,7 @@ func TestGetOrderStatus(t *testing.T) {
|
||||
if !mockTests {
|
||||
assert.ErrorContains(t, err, "Order not found")
|
||||
} else {
|
||||
require.NoError(t, err, "TestGetOrderStatus must not error")
|
||||
require.NoError(t, err, "GetOrderStatus must not error")
|
||||
assert.Equal(t, "2022-01-31 14:43:15", o.DateTime, "DateTime should match")
|
||||
assert.Equal(t, "1458532827766784", o.ID, "OrderID should match")
|
||||
assert.Equal(t, 200.00, o.AmountRemaining, "AmountRemaining should match")
|
||||
@@ -576,9 +576,8 @@ func TestCancelAllExchangeOrders(t *testing.T) {
|
||||
if !mockTests {
|
||||
sharedtestvalues.SkipTestIfCredentialsUnset(t, b, canManipulateRealOrders)
|
||||
}
|
||||
resp, err := b.CancelAllOrders(t.Context(),
|
||||
&order.Cancel{AssetType: asset.Spot})
|
||||
require.NoError(t, err, "TestCancelAllExchangeOrders must not error")
|
||||
resp, err := b.CancelAllOrders(t.Context(), &order.Cancel{AssetType: asset.Spot})
|
||||
require.NoError(t, err, "CancelAllOrders must not error")
|
||||
if len(resp.Status) > 0 {
|
||||
t.Errorf("%v orders failed to cancel", len(resp.Status))
|
||||
}
|
||||
@@ -1031,8 +1030,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)
|
||||
|
||||
Reference in New Issue
Block a user