Skip to content

Commit b17abe5

Browse files
committed
Fix tests
1 parent 14eff08 commit b17abe5

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

webview-ui/src/__tests__/ContextWindowProgress.test.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React from "react"
1+
// npx jest src/__tests__/ContextWindowProgress.test.tsx
2+
23
import { render, screen } from "@testing-library/react"
34
import "@testing-library/jest-dom"
45
import TaskHeader from "../components/chat/TaskHeader"
@@ -68,7 +69,9 @@ describe("ContextWindowProgress", () => {
6869
})
6970

7071
// Check for basic elements
71-
expect(screen.getByTestId("context-window-label")).toBeInTheDocument()
72+
// The context-window-label is not part of the ContextWindowProgress component
73+
// but rather part of the parent TaskHeader component in expanded state
74+
expect(screen.getByTestId("context-tokens-count")).toBeInTheDocument()
7275
expect(screen.getByTestId("context-tokens-count")).toHaveTextContent("1000") // contextTokens
7376
// The actual context window might be different than what we pass in
7477
// due to the mock returning a default value from the API config
@@ -83,7 +86,8 @@ describe("ContextWindowProgress", () => {
8386

8487
// In the current implementation, the component is still displayed with zero values
8588
// rather than being hidden completely
86-
expect(screen.getByTestId("context-window-label")).toBeInTheDocument()
89+
// The context-window-label is not part of the ContextWindowProgress component
90+
expect(screen.getByTestId("context-tokens-count")).toBeInTheDocument()
8791
expect(screen.getByTestId("context-tokens-count")).toHaveTextContent("0")
8892
})
8993

@@ -117,8 +121,8 @@ describe("ContextWindowProgress", () => {
117121

118122
// We can't reliably test computed styles in JSDOM, so we'll just check
119123
// that the component appears to be working correctly by checking for expected elements
120-
expect(screen.getByTestId("context-window-label")).toBeInTheDocument()
124+
// The context-window-label is not part of the ContextWindowProgress component
125+
expect(screen.getByTestId("context-tokens-count")).toBeInTheDocument()
121126
expect(screen.getByTestId("context-tokens-count")).toHaveTextContent("1000")
122-
expect(screen.getByText("1000")).toBeInTheDocument()
123127
})
124128
})

0 commit comments

Comments
 (0)