Skip to content

refactor: dedupe scoring tests and reason mapping - #38

Merged
iamaamir merged 3 commits into
mainfrom
dedupe-score-tests
Sep 8, 2026
Merged

iamaamir merged 3 commits into
mainfrom
dedupe-score-tests

Conversation

@iamaamir

@iamaamir iamaamir commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Addresses SonarQube new-code duplication (7.4% vs 3% gate).

  • lib/score.js: collapse the suppression-reason if-ladder into an insertion-ordered ISSUE_TO_HIDDEN_REASON lookup (identical output ordering).
  • tests/unit/score.test.js: classify/display/acceptance/rejection cases to it.each tables + shared helpers (scoreAtLevel, expectAcceptedScore, expectFailingCheck).
  • tests/unit/abstract-provider-cascade.test.js: non-cascadeable error trio to it.each table; shared earthCorrection payload; expectLevelsCalled helper.
  • tests/e2e-playwright/provider-contract.spec.js: extract scenario helpers (seed, open page, fill/accept, call asserts, teardown).

No behavior changes. Net -58 lines.

Replace copy-pasted cases with it.each tables and shared helpers in score.test.js (classify, display-changes, acceptance, rejection) and abstract-provider-cascade.test.js (error trio, earth payload, level-call assertions). Extract e2e scenario helpers (seed, open page, fill/accept, call asserts, teardown) in provider-contract.spec.js. Collapse the suppression-reason if-ladder in lib/score.js into an insertion-ordered lookup table with identical output ordering. No behavior changes; addresses Sonar new-code duplication.
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Removes jq formatting churn left by the release bump workflow so biome ci passes. Version unchanged (0.4.10).
@sonarqubecloud

sonarqubecloud Bot commented Sep 8, 2026

Copy link
Copy Markdown

@iamaamir
iamaamir merged commit aa11255 into main Sep 8, 2026
8 checks passed
@iamaamir
iamaamir deleted the dedupe-score-tests branch September 8, 2026 19:57
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