Skip to content

fix: resolve undefined result variable in error-utils test (#1453)#2428

Open
Bhavy12-cell wants to merge 1 commit into
Umbrella-io:mainfrom
Bhavy12-cell:fix/error-utils-vitest-1453
Open

fix: resolve undefined result variable in error-utils test (#1453)#2428
Bhavy12-cell wants to merge 1 commit into
Umbrella-io:mainfrom
Bhavy12-cell:fix/error-utils-vitest-1453

Conversation

@Bhavy12-cell

Copy link
Copy Markdown
Contributor

Summary

Fixes #1453

Problem

In test/error-utils.test.ts, one test referenced a variable result
that was never declared or assigned:

const raw = 'duplicate key value...';
expect(result).toBe("An unexpected error occurred."); // ❌ result is undefined

This caused Vitest to crash with a ReferenceError on this test.

Fix

Added the missing variable assignment on the line before expect():

const result = getSafeApiErrorMessage(raw, "production"); // ✅

One line change. All other tests were already correct and untouched.

Files Changed

  • test/error-utils.test.ts — added missing const result assignment

Testing

  • All 9 tests now pass cleanly under Vitest
  • No other files modified

@github-actions github-actions Bot added type:testing GSSoC type bonus: tests (+10 pts) gssoc26 GSSoC 2026 contribution type:accessibility GSSoC type bonus: accessibility (+15 pts) type:bug GSSoC type bonus: bug fix labels Jun 14, 2026
@github-actions

Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Umbrella-io — 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

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

Labels

gssoc26 GSSoC 2026 contribution type:accessibility GSSoC type bonus: accessibility (+15 pts) type:bug GSSoC type bonus: bug fix type:testing GSSoC type bonus: tests (+10 pts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: error-utils.test.ts crashes Vitest due to node:test usage

1 participant