traPtitech / traPtitech/Checkin

「削除済み customer の name を落とす」テストが、その主張を検証していない

Open Beginner friendly
#59 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
0
Forks
0
Avg merge
3d 5h
Merged PRs (30d)
7

Description

症状

packages/api/src/payments/payments.test.tsdrops 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-collectiond8feaca で、normalize.tsreadCustomer にある削除済みの判定を外し、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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.