hub (unreleased): review fix 6 — the test-only helpers in production files refuse outside a test binary, and no production file may call one
Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
1 parent
a6f4aa0b64
commit
efea838203
7 files changed
+144
No files matched your search
@@ -0,0 +1,22 @@
|
||||
# Review finding 6 — the test-only helpers in production files run in any binary. The test on the code BEFORE the guards:
|
||||
--- FAIL: TestReview6_TheTestOnlyHelpersRefuseOutsideATestBinary (0.05s)
|
||||
offsite_end_notice_test.go:256: SetEndNoticeForTest ran outside a test binary
|
||||
offsite_end_notice_test.go:259: …and it wrote a row: map[vikunja:{App:vikunja Press: FirstNamed:2026-08-17 16:26:23 +0000 UTC ToldAt:2026-08-17 16:26:23 +0000 UTC ToldTo:operator Tries:0 LastTry:0001-01-01 00:00:00 +0000 UTC LastReason: StuckTold:0001-01-01 00:00:00 +0000 UTC}]
|
||||
offsite_end_notice_test.go:262: BackdateNotificationLogForTest ran outside a test binary
|
||||
FAIL
|
||||
FAIL gitea.dooplex.hu/admin/felhom-hub/internal/store 0.052s
|
||||
FAIL
|
||||
--- PASS: TestReview6_NoProductionFileCallsATestOnlyHelper (0.13s)
|
||||
ok gitea.dooplex.hu/admin/felhom-hub/internal/api 0.149s
|
||||
|
||||
# After the fix: the store test above is green; by mutation:
|
||||
== MUTATION: a production function calls a test-only helper
|
||||
RED on the mutant, GREEN on the real file
|
||||
--- FAIL: TestReview6_NoProductionFileCallsATestOnlyHelper (0.13s)
|
||||
test_seams_scan_test.go:41: ../../internal/notify/end_notice.go:85 calls a test-only helper from production code: d.SetSendFnForTest(nil)
|
||||
== MUTATION: SetSendFnForTest replaces the sender in any binary
|
||||
RED on the mutant, GREEN on the real file
|
||||
--- FAIL: TestReview6_SetSendFnForTestDoesNothingOutsideATestBinary (0.05s)
|
||||
end_notice_test.go:275: the sender was replaced outside a test binary (outcome sent, replaced=true, mails through the real one=0)
|
||||
|
||||
2 mutations, 0 not a red-proof
|
||||
Reference in new issue
Block a user