Fix tests to wrap all calls changing the UI with act. (#12268)

This commit is contained in:
Jacob Richman
2025-10-30 11:50:26 -07:00
committed by GitHub
parent cc081337b7
commit 54fa26ef0e
69 changed files with 2002 additions and 1291 deletions

View File

@@ -7,6 +7,7 @@
import type React from 'react';
import { act } from 'react';
import { renderHook } from '../../test-utils/render.js';
import { waitFor } from '../../test-utils/async.js';
import type { Mock } from 'vitest';
import { vi } from 'vitest';
import type { Key } from './KeypressContext.js';
@@ -275,7 +276,7 @@ describe('KeypressContext - Kitty Protocol', () => {
act(() => writeSequence(pastedText));
await vi.waitFor(() => {
await waitFor(() => {
expect(keyHandler).toHaveBeenCalledTimes(1);
});
@@ -1020,7 +1021,7 @@ describe('Kitty Sequence Parsing', () => {
}
// Should parse once complete
await vi.waitFor(() => {
await waitFor(() => {
expect(keyHandler).toHaveBeenCalledWith(
expect.objectContaining({
name: 'escape',