kstack-testing
Installation
SKILL.md
kstack-testing
テストコードを書くときの規約。理由を理解した上で適用すること。
API テストは route 定義ファイル 1 つにつき spec 1 つにする
API のテストは route を定義するファイルごとに 1 つの spec にまとめ、追加ケースは対応する既存 spec に足す。複数の route 定義ファイルのテストを機能横断 spec に集約しない。分割単位は endpoint ではなく route 定義ファイルとし、この配置規約を一般の unit テストや E2E 全般へ広げない。
Bad:
routes/posts.ts と routes/comments.ts の API テストを
test/moderation.spec.ts に集約する
Good:
routes/posts.ts(GET /posts、POST /posts)→ test/posts.spec.ts
routes/comments.ts → test/comments.spec.ts
posts の追加ケース → 既存の test/posts.spec.ts に足す