Skip to content

Commit 11be8e5

Browse files
test(webview): cover non-Error state post failures
Exercise the stringification branch for non-Error rejections so both debounced state-post failure paths are covered. Signed-off-by: JunyongParkDev <jun94.park@samsung.com>
1 parent 9d9bfa3 commit 11be8e5

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/core/webview/__tests__/ClineProvider.spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -897,6 +897,16 @@ describe("ClineProvider", () => {
897897
)
898898
})
899899

900+
test("stringifies non-Error state post failures inside the debounced callback", async () => {
901+
const logSpy = vi.spyOn(provider, "log").mockImplementation(() => {})
902+
vi.spyOn(provider, "postStateToWebviewWithoutTaskHistory").mockRejectedValue("state post failed")
903+
904+
await expect(provider.postStateToWebviewThrottled()).resolves.toBeUndefined()
905+
expect(logSpy).toHaveBeenCalledWith(
906+
"[ClineProvider#postStateToWebviewThrottled] Failed to post state: state post failed",
907+
)
908+
})
909+
900910
test("cancels pending work on dispose and ignores later schedule or flush calls", async () => {
901911
const postStateSpy = vi.spyOn(provider, "postStateToWebviewWithoutTaskHistory").mockResolvedValue(undefined)
902912

0 commit comments

Comments
 (0)