Repository navigation
Commit bf7a9e9
committed
test(webview): re-adopt main's ten ClineProvider spec cases onto the split harness
The merge e943530 left ten titles in src/core/webview/__tests__/ClineProvider.spec.ts
without survivors in our tree - all in-base, all absent on our pre-merge parent
9819b5f, none elsewhere in the tree, and every production symbol they exercise still
present. They are test-only, so they are ported here rather than answered in writing.
Ported verbatim from e943530^2 into the same describes. What our rewrite had done to
each case, by title:
Deleted outright (the distinctive fixture literals survived only inside the file-level
vi.mock factories; the assertions did not) - re-adopted here:
validates and falls back to default mode when restored mode no longer exists
preserves mode when it exists in custom modes (only main's negative case remained, in
our 'should not restore a persisted mode whose custom mode was deleted')
preserves mode when it exists in built-in modes
handles history items without mode property
continues with task restoration even if mode config loading fails
updates every zoo-gateway profile and activates only the active one (the update-all and
activate-only probes were gone; our 'creates a Zoo Gateway profile when none exists'
covers neither)
skips seeding when every zoo-gateway profile already has the current token and base URL
re-seeds when any zoo-gateway profile has a stale or missing token
re-seeds when any zoo-gateway profile has a stale base URL (our describe kept only
main's first seeding case, byte-identical)
createTaskWithHistoryItem mode validation - the grouping describe itself
Reworded to the observable this tree ships - expected values and intent unchanged (4 of
the 10, all four listed above as deleted first):
- the three mode cases asserted globalState.update("mode", <slug>). This branch persists
the restored mode through the view's own pin (ClineProvider.ts:1998 saveViewState, and
the comment above it says why a global write is wrong in parallel mode), so each case
now asserts update("viewStates", ...) plus viewLocalState.mode === <slug> and keeps
main's getCustomModes / getModeBySlug / log-fallback / historyItem.mode assertions
untouched. Nothing was dropped or loosened: the same value is pinned, for this view.
- the gateway case asserted saveConfig("Backup Zoo", objectContaining(token, baseUrl)).
This branch refreshes every zoo-gateway profile through upsertProviderProfile so that a
view pinned to a profile re-resolves it (ClineProvider.ts:3393-3407), so the case now
asserts the second upsert call carrying activate:false and that saveConfig was not
called at all. The title's 'activates only the active one' is asserted, not implied.
Harness-only edits inside the ported blocks: the readonly member swaps go through one
declared structural type (MemberSwapTarget) instead of 'as any', and mock payloads use
as never, so this file's no-explicit-any suppression count did not rise.
Verification: prettier --check clean; tsc --noEmit -p . clean; eslint --max-warnings=0
clean (0 errors) on the spec plus ClineProvider.ts, ContextProxy.ts and ContextProxy.spec
.ts; vitest run core/config core/webview --no-file-parallelism = 44 files / 1299 tests
passed (1290 before, +9 ported cases). Staged explicitly: only
src/core/webview/__tests__/ClineProvider.spec.ts (+424 -5). Measured with the same script
and base as the other heads: PACKAGE extension still 810 changed executable lines, so this
head adds 0 executable lines (spec paths never count against the 500-line gate).1 parent 08b633d commit bf7a9e9
1 file changed
Lines changed: 424 additions & 5 deletions
0 commit comments