traPtitech / traPtitech/Checkin
「削除済み customer の name を落とす」テストが、その主張を検証していない
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 0
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 7
Description
症状
packages/api/src/payments/payments.test.ts の drops the name for a deleted (expanded) customer は、invoiceToRow が削除済みの customer から name を落とすことを主張している。しかし渡しているフィクスチャが { id: 'cus_del', deleted: true, object: 'customer' } で name を持たないため、packages/api/src/payments/normalize.ts の customer の読み取りが customer.name ?? null である限り、削除済みかどうかを見ない実装に変えても結果は null のままになる。2026-09-18 に feat/merge-auth-collection の d8feaca で、normalize.ts の readCustomer にある削除済みの判定を外し、const name = customer.name ?? null に置き換えたうえで npx vitest run packages/api/src/payments/payments.test.ts を実行したところ、22 件すべてが通った。
誰が何を誤るか
このテストが通っていることを根拠に、削除済み customer の名前が出力に載らないと判断する人が出る。実際にはその保証は無い。
直す方向
フィクスチャに name を持たせる(たとえば { id: 'cus_del', deleted: true, object: 'customer', name: '退会した人' })。そうすると、削除済みを見ない実装では name がそのまま出て、テストが失敗するようになる。
直さずに残した理由
テストの主張が成り立たなくなる変異を複数用意して、どの変異でも失敗することを確かめる作業を伴うので、独立した変更として行うほうが確認しやすい。
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the drops the name for a deleted (expanded) customer test in packages/api/src/payments/payments.test.ts and the readCustomer logic in packages/api/src/payments/normalize.ts. Run npx vitest run packages/api/src/payments/payments.test.ts, then verify the test fails when the deleted-customer check is removed and passes with the intended fixture. Done means the test genuinely distinguishes deleted customers from customers whose name is absent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend-api-design, testing
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 86/100