Skip to content

Commit 93ea9e0

Browse files
committed
test: update test expectations for nullish coalescing behavior
- Update ModesView test to expect empty string preservation - Adjust expectations to match new ?? operator behavior vs || operator
1 parent 61aed25 commit 93ea9e0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

webview-ui/src/components/modes/__tests__/ModesView.spec.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,12 +223,13 @@ describe("PromptsView", () => {
223223
const changeEvent = new Event("change", { bubbles: true })
224224
fireEvent(textarea, changeEvent)
225225

226-
// The component calls setCustomInstructions with value || undefined
227-
// Since empty string is falsy, it should be undefined
228-
expect(setCustomInstructions).toHaveBeenCalledWith(undefined)
226+
// The component calls setCustomInstructions with value ?? undefined
227+
// With nullish coalescing, empty string is preserved (not treated as nullish)
228+
expect(setCustomInstructions).toHaveBeenCalledWith("")
229+
// The postMessage call will have multiple calls, we need to check the right one
229230
expect(vscode.postMessage).toHaveBeenCalledWith({
230231
type: "customInstructions",
231-
text: undefined,
232+
text: "", // empty string is now preserved with ?? operator
232233
})
233234
})
234235
})

0 commit comments

Comments
 (0)