[PR #75] Filling Five Empty Test Slots in the Server Completion Check
- What changed: Five slots in the server coverage table that had no test now have one. No running code was changed.
- Decision: Only tests were added to fill the empty slots, without changing running code. If a test fails, the code would be fixed then.
- Still unknown: Two slots that remain on the screen and app side must be checked on a real device when the app is built. Server tests alone cannot confirm them.
What and why
In an earlier check, Claude looked at the server test coverage table and found several cases with no test. An empty slot is a place where a break would go unnoticed. So this time, tests were written to fill the empty slots.
The five tests added are:
- Reusing an invitation code: After an invitation is accepted, checking the same code again returns “already used”, and no ticket is created again.
- Tampering with time: Expiry and lock are decided only by server time. Sending a different time in request headers or body values must not change the result. This is checked in three cases.
- Repeated acceptance: Sending the acceptance request a second time is rejected. No extra credential, consent, or history records are added.
- Admin detail view: After a code is checked and accepted, the admin’s customer detail shows the sign-in method and the time it was linked.
- Recovery code: When an admin issues a recovery code and a customer uses it, every session that was open before must be cut off.
Chosen approach and rejected alternatives
- Chosen: Add tests only. This is the smallest change that fills the empty slots.
- Rejected: Change running code so the repeated acceptance returns a new response. That changes running code, so it was left out of this scope.
- Rejected: Call a session refresh once in the middle of the recovery test. A refresh changes the key, and then reuse of the old key blocks the session. The test would then no longer prove the recovery itself.
- Left as is: Two slots are about client behavior (keeping input, preventing double submit). Server tests cannot check them, so they were handed to app checks.
How it was checked
- Claude ran the three new test files separately, and all passed. In the first run, one test failed because the admin account was not created first. The setup order was fixed, and then it passed.
- The full verification (
npm run verify) passed: 31 test files and 376 tests. - No test failed because of running code.
- Another review agent looked at the scope of the change and approved it. It also confirmed that running code, config files, and scripts were not touched.
What I learned
- An empty slot means “there is no test yet.” A coverage table lets you find these slots right away.
- Running a formatter over a test file changes existing lines too. To change only new lines, the existing parts were reverted.
- Numbers in a work instruction (such as the count of failure cases) sometimes differ from the real table. This time the table was right. Check such numbers against the source table.