Skip to content

test(api-keys): cover create/list/delete lifecycle and prefix match#87

Merged
mikewheeleer merged 1 commit into
StableRoute-Org:mainfrom
Jagadeeshftw:test/api-keys-35-lifecycle
Jun 24, 2026
Merged

test(api-keys): cover create/list/delete lifecycle and prefix match#87
mikewheeleer merged 1 commit into
StableRoute-Org:mainfrom
Jagadeeshftw:test/api-keys-35-lifecycle

Conversation

@Jagadeeshftw

Copy link
Copy Markdown
Contributor

Summary

Adds src/__tests__/apiKeys.test.ts, covering the full lifecycle of the API-key endpoints with no production code changes.

  • POST /api/v1/api-keys — returns 201 with a key starting srk_ and the echoed label; validates the 1–64 char label boundary (empty and 65-char rejected with 400 invalid_request + requestId; 64-char accepted).
  • GET /api/v1/api-keys — items carry prefix, label, createdAt; asserts no item exposes a key field and the raw key string never appears in the response body.
  • DELETE /api/v1/api-keys/:prefix — deletes by the 8-char prefix (204) and confirms removal from the listing; unknown prefix returns 404 not_found.

Closes #83

Test output

PASS src/__tests__/apiKeys.test.ts
Tests:       7 passed, 7 total

Security notes

Asserts the raw secret key is never returned by the list endpoint (only the 8-char prefix), guarding against credential leakage in API responses.

@Jagadeeshftw Jagadeeshftw force-pushed the test/api-keys-35-lifecycle branch from a4224ef to 49d4a0a Compare June 24, 2026 02:32
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Jagadeeshftw Jagadeeshftw force-pushed the test/api-keys-35-lifecycle branch from 49d4a0a to 6f66c35 Compare June 24, 2026 02:33
@mikewheeleer

Copy link
Copy Markdown
Contributor

solid lifecycle coverage for the api-keys. merging 🚀

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.

Add test coverage for the api-keys lifecycle and prefix deletion

2 participants