Skip to content

test: add list and delete route test coverage - #124

Closed
Furox-Art wants to merge 2 commits into
tscircuit:mainfrom
Furox-Art:add-list-delete-route-tests
Closed

Furox-Art wants to merge 2 commits into
tscircuit:mainfrom
Furox-Art:add-list-delete-route-tests

Conversation

@Furox-Art

@Furox-Art Furox-Art commented Sep 8, 2026 •

Copy link
Copy Markdown

Closes #2
/claim #2

Disclosure: This PR was authored by @Furox-Art (AI-assisted). Happy to adjust anything.

Summary

Adds the missing route test coverage for things/list and things/delete,
following the established getTestServer + ky fixture pattern, and fixes the
un-awaited create request on the existing test.

New tests — tests/routes/things/list.test.ts

  • Empty list returns { things: [] } before anything is created
  • All created things are returned with thing_id/name/description in
    creation order, and thing_id values are unique
  • A fresh server instance reflects only its own state (no cross-test leakage)

New tests — tests/routes/things/delete.test.ts

  • Deleting a specific thing removes exactly that thing from the list
  • Deleting one of several keeps the others intact (verifies thing_id
    matching, not just count)
  • Deleting a non-existent thing_id still returns { ok: true } and leaves
    the list unchanged (documents current idempotent behavior)
  • Deleting the same thing twice succeeds without error

Fix — tests/routes/things/create.test.ts

  • ky.post is now awaited (the un-awaited request could race the subsequent
    list assertion) and the { ok: true } response + created fields are
    asserted

Notes

  • Delete requests use new URLSearchParams(...) bodies, matching the
    application/x-www-form-urlencoded contract of the route spec.
  • All response assertions use explicit json<{ ok: boolean }>() typing so
    tsc --noEmit stays clean.

Verification

  • bun test tests/routes/ → 9 pass, 0 fail (2 existing + 7 new)
  • tsc --noEmit → no errors in tests/
  • biome format clean on all touched files

Adds missing route tests exercising the ky test-server fixture:

- things/list: empty list, all created things returned with fields and
  order, fresh-server isolation
- things/delete: removes the targeted thing only, keeps others intact,
  idempotent success for missing and repeated deletes (documents current
  ok:true behavior)

All requests are awaited (the un-awaited create.test.ts call can race
the list assertion). 9/9 tests pass with bun test.

Closes #2

Signed-off-by: Furox-Art <Furox-Art@users.noreply.github.com>
Addresses review-pass findings: explicit json<{ok:boolean}> generics on
delete assertions (4 tsc errors), await the create call in
create.test.ts (un-awaited request could race the list assertion) with
response+field assertions, unique thing_id assertion, biome formatting.

Closes #2

Signed-off-by: Furox-Art <Furox-Art@users.noreply.github.com>
@Furox-Art

Copy link
Copy Markdown
Author

Withdrawing — the linked bounty (#2) is already marked 💰 Rewarded and has several competing PRs. Closing to keep the queue clean.

@Furox-Art Furox-Art closed this Sep 11, 2026
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.

Switch to ky from redaxios

1 participant