Skip to content

test: harden ky coverage for create/delete/list routes - #120

Open
jhzAliyy wants to merge 2 commits into
tscircuit:mainfrom
jhzAliyy:bounty/ky-test-coverage-jhzaliyy
Open

jhzAliyy wants to merge 2 commits into
tscircuit:mainfrom
jhzAliyy:bounty/ky-test-coverage-jhzaliyy

Conversation

@jhzAliyy

@jhzAliyy jhzAliyy commented Jun 22, 2026 •

Copy link
Copy Markdown

/claim #2

Summary

Fixes and expands test coverage for the ky HTTP client migration bounty (#2):

create.test.ts (rewritten)

  • Fixed a race condition: ky.post() was not awaited
  • Added proper HTTP response and body assertions
  • Added thing_id to response type
  • 2 new tests: incrementing thing_ids, empty string acceptance

delete.test.ts (new, 3 tests)

  • Delete removes correct thing by thing_id
  • Idempotent for non-existent IDs
  • New create after delete gets fresh ID

list.test.ts (new, 4 tests)

  • Empty array on fresh server
  • Full field validation
  • Insertion order preserved
  • CRUD sequence consistency

All tests use ky throughout, follow existing getTestServer pattern.

Closes #2

- Fix create.test.ts: await ky.post and assert response (was a race condition)
- Add 2 new create tests: incrementing thing_ids, empty string acceptance
- Add delete.test.ts: remove by id, idempotent no-op, new id after delete
- Add list.test.ts: empty list, full field validation, insertion order, CRUD sequence
- Collapse .get().json() chains when type annotation is multi-line
- Remove non-null assertion (noNonNullAssertion lint rule)
- Sort imports: { expect, test } before { getTestServer }
- Preserve ! assertions (noNonNullAssertion is off in biome config)
@jhzAliyy
jhzAliyy force-pushed the bounty/ky-test-coverage-jhzaliyy branch from 1e09922 to 942e939 Compare June 22, 2026 07:16
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