Skip to content

Conversation

asgeija
Copy link
Member

@asgeija asgeija commented Oct 15, 2026

Replaces #67, which got stuck. Same commits (by @jonatsm), merged with the latest main.

Closes #43

What changed

  • SearchPage tests: cover the loading and empty states.
  • SubmitSightingPage tests: cover the wanted form behavior.
  • Fix: the submit error summary is now hidden once the fields are fixed (SubmitSightingPage.tsx).
  • Tooling: npm run test now runs the frontend (Vitest) and backend tests once, as CI does.
  • Backend test script: now runs through tsx. Running the .ts test file directly gave ERR_UNKNOWN_FILE_EXTENSION on some Node versions. The same fix is in b1972db.
  • Docs: AGENTS.md updated to match the new test commands.

Review history from #67

  • @asgeija reported ERR_UNKNOWN_FILE_EXTENSION when running npm test and asked for the backend test script to run through tsx.
  • @jonatsm fixed it in b1972db, and @asgeija confirmed that npm test works.
  • @asgeija approved the PR. The approval was later dismissed as stale because the merge-base changed after it was given.
  • 43 update component tests for apollo #67 then got stuck on the code owner review requirement, so the same commits are opened here against the current main.

The commits are unchanged apart from the merge with main, so this needs a fresh approval but should not need new code review.

Testing

  • npm run lint
  • npm run test

Component tests mock Apollo, so no backend or database is needed.

AI usage

Claude Code was used to copy this PR onto a new branch. The code changes are the original work from #67.

jonatsm and others added 8 commits October 12, 2026 13:14
Give the fake backend an optional latency so states that only exist
while waiting can be tested, and test the first load, a serach with
no matches and a new serach while old results are shown.

Refs #43
…e-backen' into 43-update-component-tests-for-apollo
The summary counted keys in the errors object, but fixing a field
set its error to undefined without removing the key.
Now it checks for actual messages instead.

Fixes #63
Check that an invalid form sends no request and links each error to
its feild, that the error summary goes away once the fileds are fixed,
that a double click sends on requests, and that a sbmitted
sighting shows up in the search list. Uses a fake database
that stores the sighting and counts requests.

Refs #43, #64
npm test started Vitest in watch mode and only reached
the backend tests after quitting it. Run Vitest once by
default, like CI, and moved watch mode to npm run test:watch.
Documented in AGENTS.md.

Refs #43
node --test only runs .ts files by itself from Node 22.18, so npm test
failed with ERR_UNKNOWN_FILE_EXTENSION on older Node 22 version. Now the
tests are ran through tsx instead, and Node 22 is set as the minimum
version in package.json.

Refs #43
@asgeija asgeija requested a review from a team as a code owner October 15, 2026 08:49
@asgeija asgeija added the test label Oct 15, 2026
@asgeija asgeija added this to the Partial submission 2 milestone Oct 15, 2026
@asgeija asgeija added bug Something isn't working configuration labels Oct 15, 2026
@asgeija asgeija merged commit 6be0218 into main Oct 15, 2026
1 check passed
@asgeija asgeija deleted the 43-update-component-tests-for-apollo-copy branch October 15, 2026 08:51
Sign in to join this conversation on GitHub.
Labels
bug Something isn't working configuration test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update component tests for Apollo
2 participants