Commit 1ca9ca0
committed
test(tui): invoke save cmd once and guard against nil
TestMedia_EditProfileCallsMediaFilePath called the cmd returned by
form.save() twice — once for the type assertion and again inside
the failure t.Fatalf format string. The closure has side effects
(records SetProfileMediaFilePath on the mock), so a failure path
would double-record and obscure the real assertion.
Capture the result in a local variable, invoke once, and add a
nil-cmd guard so a future regression in form.save() that returns
nil panics fast at the assertion rather than nil-derefencing on
cmd().1 parent cf1fcd2 commit 1ca9ca0
1 file changed
Lines changed: 10 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
121 | 129 | | |
122 | | - | |
| 130 | + | |
123 | 131 | | |
124 | 132 | | |
125 | 133 | | |
| |||
0 commit comments