First batch of fixing tests to use best practices. (#11964)

This commit is contained in:
Jacob Richman
2025-10-25 14:41:53 -07:00
committed by GitHub
parent 8352980f01
commit ee66732ad2
48 changed files with 1128 additions and 1113 deletions

View File

@@ -5,7 +5,7 @@
*/
import { renderWithProviders } from '../../test-utils/render.js';
import { act } from '@testing-library/react';
import { act } from 'react';
import type { InputPromptProps } from './InputPrompt.js';
import { InputPrompt } from './InputPrompt.js';
import type { TextBuffer } from './shared/text-buffer.js';
@@ -1936,7 +1936,7 @@ describe('InputPrompt', () => {
await vi.waitFor(() => expect(mockPopAllMessages).toHaveBeenCalled());
const callback = mockPopAllMessages.mock.calls[0][0];
act(() => {
await act(async () => {
callback('Message 1\n\nMessage 2\n\nMessage 3');
});
expect(props.buffer.setText).toHaveBeenCalledWith(
@@ -1978,7 +1978,7 @@ describe('InputPrompt', () => {
});
await vi.waitFor(() => expect(mockPopAllMessages).toHaveBeenCalled());
const callback = mockPopAllMessages.mock.calls[0][0];
act(() => {
await act(async () => {
callback(undefined);
});
@@ -2021,7 +2021,7 @@ describe('InputPrompt', () => {
await vi.waitFor(() => expect(mockPopAllMessages).toHaveBeenCalled());
const callback = mockPopAllMessages.mock.calls[0][0];
act(() => {
await act(async () => {
callback('Single message');
});
@@ -2077,7 +2077,7 @@ describe('InputPrompt', () => {
await vi.waitFor(() => expect(mockPopAllMessages).toHaveBeenCalled());
const callback = mockPopAllMessages.mock.calls[0][0];
act(() => {
await act(async () => {
callback(undefined);
});