Skip to content

test(useGitHub): fix and unskip the missing-branchName test#52

Open
dev48v wants to merge 1 commit into
weval-org:mainfrom
dev48v:fix/issue-49-usegithub-branchname-test
Open

test(useGitHub): fix and unskip the missing-branchName test#52
dev48v wants to merge 1 commit into
weval-org:mainfrom
dev48v:fix/issue-49-usegithub-branchname-test

Conversation

@dev48v

@dev48v dev48v commented Jul 1, 2026

Copy link
Copy Markdown

Summary

Fixes the skipped useGitHub test called out in #49.

should throw an error if branchName is missing was .skipped during the Jest→Vitest migration (#45 / PR #46) because it asserted a throw, but updateFileOnGitHub actually returns null (after showing a destructive "Branch Required" toast) when branchName is missing.

Fixes #49

Decision: keep the source, fix the test

Returning null is the intended contract, not a bug:

  • updateFileOnGitHub is declared Promise<BlueprintFile | null>.
  • Its other guard clause (workspace not ready) already does the same thing — toast + return null.
  • Callers handle a null result rather than a thrown error.

So this aligns the test with the source (the graceful no-op) instead of changing the source. The test is renamed, un-skipped, and now asserts that the call:

  • returns null,
  • shows the Branch Required destructive toast,
  • makes no fetch.

Testing

  • pnpm vitest run --project web src/app/sandbox/hooks/useGitHub.test.ts12 passed (previously 11 + 1 skipped).
  • pnpm test:web49 files / 597 tests passed, none skipped from this file.
  • pnpm typecheck → clean (0 errors).

Test-only change; no source/behavior change.

The "should throw an error if branchName is missing" test was skipped
during the Jest→Vitest migration because it asserted a throw, while
updateFileOnGitHub actually returns null (after a destructive toast) when
branchName is missing — consistent with its BlueprintFile | null return
type and its other guard clauses.

The null/no-op behavior is the intended contract, so align the test with
it instead of the source: assert it returns null, shows the "Branch
Required" toast, and makes no fetch. Renamed and un-skipped.

Fixes weval-org#49
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.

Fix skipped test: useGitHub "throw when branchName missing" (source returns null, not throws)

1 participant