Repository navigation
Commit d19bb3f
committed
test(extension): cover the explicit unset at the API viewStates door
The row on src/extension/__tests__/api-configuration.spec.ts:101 was right that the API boundary pinned only
the populated map, and an explicit unset is the same hazard: ContextProxy reads an undefined value as a
delete - the repo relies on update(key, undefined) at ContextProxy.ts:173, :280-282, :305 and :346 - and
withoutInvalidDisplaySettings cannot catch the key either, because it filters through Object.entries, so a
key holding undefined survives it and reaches both writes.
One thing worth recording about the shape of the test, because it decides whether the case has teeth:
toHaveBeenCalledWith compares the way toEqual does and ignores undefined-valued keys. Measured with a
throwaway probe against this vitest: a mock called with { soundEnabled: true, viewStates: undefined }
satisfies toHaveBeenCalledWith({ soundEnabled: true }), while toStrictEqual on the same shape fails with
+ "viewStates": undefined. So an assertion written only in the loose form would have passed on this head
with the drop removed, and the strict assertions on the captured arguments are the ones carrying the teeth
here. The loose assertions stay next to them for continuity with the case above.
Case at api-configuration.spec.ts:109-137: setConfiguration({ viewStates: undefined, soundEnabled: true })
must call contextProxy.setValues and providerSettingsManager.saveConfig with an object that strictly equals
{ soundEnabled: true }, against the profile name default, and must log the ignore. Control: with the guard
block at src/extension/api.ts:645-656 spliced out the file reports 2 failed | 9 passed, the new case red on
expected { viewStates: undefined, ... } to strictly equal { soundEnabled: true }; with the guard in place it
is 11 passed, exit 0.
Gates on the committed text: api-configuration 11, displaySettings 22, ClineProvider 475, webviewMessageHandler
176, all passing; src tsc --noEmit exit 0; eslint clean, and neither touched file carries a suppression
entry, so src/eslint-suppressions.json came back byte-identical to its blob at 3298; the compile-job
command list reproduced the previous heads exactly in job order - 1,0,0,0,1,1,0,0,0,0,0,0,0 - with the same
two box-local attributions (format:check against 2004 locally-CRLF files, none of them the file touched
here, and the two solheim record.sh suites needing ffprobe and POSIX separators). Test-only: no behaviour
touched, no changeset, no CHANGELOG, no suppression change.1 parent 696aa22 commit d19bb3f
1 file changed
Lines changed: 36 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
103 | 139 | | |
104 | 140 | | |
105 | 141 | | |
| |||
0 commit comments