( ideMessenger: MockIdeMessenger, input: string, response: ChatMessage[], )
| 75 | } |
| 76 | |
| 77 | export async function sendInputWithMockedResponse( |
| 78 | ideMessenger: MockIdeMessenger, |
| 79 | input: string, |
| 80 | response: ChatMessage[], |
| 81 | ): Promise<void> { |
| 82 | // Setup the mock response before any actions |
| 83 | ideMessenger.chatResponse = response; |
| 84 | |
| 85 | // Wait for the editor to be in the document |
| 86 | const editor = await getMainEditor(); |
| 87 | |
| 88 | // Find the submit button |
| 89 | const sendButton = await getElementByTestId("submit-input-button"); |
| 90 | |
| 91 | // Insert content into the editor |
| 92 | await act(async () => { |
| 93 | editor.commands.insertContent(input); |
| 94 | }); |
| 95 | |
| 96 | await getElementByText(input); |
| 97 | |
| 98 | // Click the send button |
| 99 | await act(async () => { |
| 100 | sendButton.click(); |
| 101 | }); |
| 102 | } |
no test coverage detected