Skip to content

Refactor dashboard widget tests for better clarity - #3314

Open
rudrakshtank wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
rudrakshtank:issue3313
Open

Refactor dashboard widget tests for better clarity#3314
rudrakshtank wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
rudrakshtank:issue3313

Conversation

@rudrakshtank

Copy link
Copy Markdown
Contributor

Summary

Closes #3313


Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that changes existing behavior)
  • 📝 Documentation update
  • ♻️ Refactor / code cleanup (no functional change)
  • ⚡ Performance improvement
  • 🔒 Security fix
  • 🧪 Tests only

Checklist

  • Linked the related issue above
  • Self-reviewed my own diff
  • No unnecessary console.log, debug code, or commented-out blocks
  • npm run lint passes locally
  • No TypeScript errors (npm run type-check)
  • Added or updated tests where applicable
  • Updated documentation / comments if behavior changed

@github-actions github-actions Bot added type:testing GSSoC type bonus: tests (+10 pts) gssoc26 GSSoC 2026 contribution type:refactor GSSoC type bonus: refactor (+10 pts) labels Jul 31, 2026
@github-actions

Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Priyanshu-byte-coder — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

@Priyanshu-byte-coder

Copy link
Copy Markdown
Owner

This adds TypeScript syntax to a .js file, which is why Playwright smoke tests is failing:

// e2e/dashboard-widgets.spec.js
const contributionRequests: string[] = [];
const goalPosts: unknown[] = [];
function mockMetricResponse(url: string) {

Playwright picks its esbuild loader from the file extension, so type annotations in a .js file are a parse error rather than something that gets stripped.

Two of the changes in here are genuinely good and worth keeping:

  • Scoping the goals route to /\/api\/goals(\?|$)/ so it stops shadowing /api/goals/sync — that's a real bug, the endpoint exists.
  • expect.poll(() => goalPosts.length).toBe(1) instead of polling the array reference — better failure output.

To land them: either drop the type annotations, or rename the file to .spec.ts and keep them. Renaming is the nicer outcome long-term, but it's a bigger diff — your call.

One more thing: the diff removes the await page.getByRole("button", { name: "Show 90-day range" }).first().click(); line and leaves the following await page.locator(...) chain, which changes what that test clicks. If that was intentional, say so in the description; if not, it's worth a second look.

@github-actions

Copy link
Copy Markdown

This PR has been inactive for 21 days. If it is still in progress, please leave an update — otherwise it will be closed in 7 days.

@github-actions github-actions Bot added the stale Inactive for 21+ days label Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc26 GSSoC 2026 contribution stale Inactive for 21+ days type:refactor GSSoC type bonus: refactor (+10 pts) type:testing GSSoC type bonus: tests (+10 pts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Fix route shadowing wildcard breaking goals sync and remove redundant click

2 participants