SONARAZDO-589 Fix test using promise-returning assertion without awaiting - #585
Conversation
Code Review ✅ ApprovedAdded missing await statements to promise-returning assertions in api-test.ts, ensuring proper test execution and validation. No issues found. OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
|
|
zglicz
left a comment
There was a problem hiding this comment.
The change makes sense: for Jest .rejects, the assertion promise should be awaited, while the promise under test should be passed directly to expect(...).
One follow-up worth considering: the same unawaited .rejects pattern is still present in the sibling common variants:
src/common/sonarqube-v7/helpers/__tests__/api-test.ts:125,:133,:185,:198,:205src/common/sonarcloud-v3/helpers/__tests__/api-test.ts:125,:133,:185,:198,:205
Those look like active test packages under the root npm test wiring, so it would be good to apply the same cleanup there too, either in this PR or a follow-up.
@zglicz Thank you for the review! |





Fixes issues appearing after new rules were added to the Typescript QP.
Summary by Gitar
async/awaitto tests inapi-test.tsto properly handle promise-returning assertionsexpect(...).rejects.toThrow()calls that were previously missing the requiredawaitThis will update automatically on new commits.