mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-05 08:10:14 +00:00
fix: update test to handle new checkRulesDirectory behavior
The ModesView component now checks for rules directory on mount, which was causing the test to fail. Updated the test to clear mock calls after mount and properly simulate the focus/change/blur sequence for field editing.
This commit is contained in:
parent
42ff98163d
commit
3b726a284b
1 changed files with 9 additions and 0 deletions
|
|
@ -95,9 +95,15 @@ describe("PromptsView", () => {
|
|||
it("handles prompt changes correctly", async () => {
|
||||
renderPromptsView()
|
||||
|
||||
// Clear any messages that were sent during component mount (like checkRulesDirectory)
|
||||
vitest.clearAllMocks()
|
||||
|
||||
// Get the textarea
|
||||
const textarea = await waitFor(() => screen.getByTestId("code-prompt-textarea"))
|
||||
|
||||
// First focus the textarea to trigger the editing state
|
||||
fireEvent.focus(textarea)
|
||||
|
||||
// Simulate VSCode TextArea change event
|
||||
const changeEvent = new CustomEvent("change", {
|
||||
detail: {
|
||||
|
|
@ -109,6 +115,9 @@ describe("PromptsView", () => {
|
|||
|
||||
fireEvent(textarea, changeEvent)
|
||||
|
||||
// Now blur to trigger the save
|
||||
fireEvent.blur(textarea)
|
||||
|
||||
expect(vscode.postMessage).toHaveBeenCalledWith({
|
||||
type: "updatePrompt",
|
||||
promptMode: "code",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue