Skip to content

bug: add assertions to service spec tests (SonarQube S2699)#34

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1781099978-s2699-test-assertions
Open

bug: add assertions to service spec tests (SonarQube S2699)#34
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1781099978-s2699-test-assertions

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Jun 10, 2026

Copy link
Copy Markdown

Summary

Resolves the 9 open SonarQube S2699 blockers ("Add at least one assertion to this test case") in the Angular service specs. These tests subscribed to a service call and used httpMock.expectOne(...) to drive the request, but had no expect(...) call — expectOne is not recognized by SonarQube as an assertion, so the tests were flagged as assertion-less.

Each flagged test now asserts the captured request's HTTP method, matching the existing convention used in the surrounding tests (e.g. articles.service.spec.ts:114, comments.service.spec.ts:173).

  const req = httpMock.expectOne(`/profiles/${username}`);
+ expect(req.request.method).toBe('GET');
  req.flush({ profile: { ...mockProfile, username } });

Files / tests touched:

  • articles.service.spec.ts — "should handle pagination parameters" (GET)
  • comments.service.spec.ts — "slug with special characters" (GET), "numeric comment ID" / "UUID comment ID" (DELETE)
  • profile.service.spec.ts — "username with special characters", "with numbers", "with hyphens", "with underscores", "very long username" (GET)

Notes

  • The reported rule was java:S2699, but there are no java:S2699 issues in this org's SonarQube — the matching blockers are typescript:S2699 in this repo. Same rule (S2699), TypeScript analyzer.
  • Verified the 3 edited spec files pass (78 tests green). Note: the repo's unit test suite is currently broken on main independently of this change — every spec imports zone.js which is not a declared dependency, so all spec files fail to load on a clean checkout. Tests here were validated by temporarily installing zone.js locally (not part of this PR). This pre-existing test-setup gap may want a separate fix.

Link to Devin session: https://app.devin.ai/sessions/8bf682121cf4422e9d34860899031849
Requested by: @Colhodm


Devin Review

Status Commit
🟢 Reviewed eda2fcf
Open in Devin Review (Staging)

Co-Authored-By: Arjun Mishra <arjunsaxmishra@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@staging-devin-ai-integration staging-devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review (Staging)
Debug

Playground

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant