Skip to content

test(e2e): the last four specs use the shared apiCall instead of their own fetch helper - #584

Merged
huyplb merged 1 commit into
mainfrom
test/e2e-shared-api-helper
Nov 1, 2026
Merged

huyplb merged 1 commit into
mainfrom
test/e2e-shared-api-helper

Conversation

@huyplb

@huyplb huyplb commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Board card e2e-api-helper: #550 added apiCall to helpers/accounts.ts, but four specs still defined their own copy of the same fetch wrapper:

  • admin-policy
  • auth-recovery
  • git-migrations
  • workspaces

Each local api is now a one-line call into apiCall, keeping its signature, so all 57 call sites are unchanged. The now-unused API_URL constants are gone from three specs.

Differences checked:

  • Two old copies tested body for truthiness rather than !== undefined; no call passes a falsy body.
  • With an empty cookie, the old auth-recovery copy sent no cookie header, while apiCall sends an empty one. The signed-out cases (/auth/password/code 404, login 401 and 200) pass either way.

Run against a live API and web app:

Spec Result
workspaces 8/8
auth-recovery 4/4
admin-policy 2 passed, 2 skipped (the server holds the one-admin policy)
git-migrations Postgres 5/5, MySQL 5/5 after a reseed

The first MySQL run failed: the container was stopped, then the seed was stale (RUNNING_E2E.md: reseed before every run).

e2e tsc and eslint are clean.

🤖 Generated with Claude Code


Note

Low Risk
Test-only refactor with behavior verified against a live API; no production code paths affected.

Overview
Four E2E specs (admin-policy, auth-recovery, git-migrations, workspaces) no longer define their own fetch-based /api wrappers. Each keeps a one-line local api that forwards to apiCall from helpers/accounts.ts, so existing call sites and signatures stay the same.

The duplicated E2E_API_URL constants are removed from three of those files (centralized on the helper). workspaces still declares API_URL for a couple of direct login fetch calls that need set-cookie parsing.

This is deduplication only—no test logic or assertions change.

Reviewed by Cursor Bugbot for commit 010c3dd. Bugbot is set up for automated code reviews on this repo. Configure here.

…r own fetch helper

admin-policy, auth-recovery, git-migrations and workspaces each defined
the same `api()` fetch wrapper. Each is now a one-line call into
helpers/accounts.ts's apiCall, so the 57 call sites stay as they are and
there is one place that builds a request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@huyplb
huyplb merged commit bd08a8f into main Nov 1, 2026
12 checks passed
@huyplb
huyplb deleted the test/e2e-shared-api-helper branch November 1, 2026 21:38
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