test(cli): refactor tests for async render utilities (#23252)

This commit is contained in:
Tommaso Sciortino
2026-03-20 20:08:29 +00:00
committed by GitHub
parent 86a3a913b5
commit 6c78eb7a39
198 changed files with 3592 additions and 4802 deletions

View File

@@ -154,7 +154,7 @@ describe('SessionBrowser component', () => {
const onDeleteSession = vi.fn().mockResolvedValue(undefined);
const onExit = vi.fn();
const { lastFrame, waitUntilReady } = render(
const { lastFrame } = await render(
<TestSessionBrowser
config={config}
onResumeSession={onResumeSession}
@@ -163,7 +163,6 @@ describe('SessionBrowser component', () => {
testSessions={[]}
/>,
);
await waitUntilReady();
expect(lastFrame()).toMatchSnapshot();
});
@@ -192,7 +191,7 @@ describe('SessionBrowser component', () => {
const onDeleteSession = vi.fn().mockResolvedValue(undefined);
const onExit = vi.fn();
const { lastFrame, waitUntilReady } = render(
const { lastFrame } = await render(
<TestSessionBrowser
config={config}
onResumeSession={onResumeSession}
@@ -201,7 +200,6 @@ describe('SessionBrowser component', () => {
testSessions={[session1, session2]}
/>,
);
await waitUntilReady();
expect(lastFrame()).toMatchSnapshot();
});
@@ -245,7 +243,7 @@ describe('SessionBrowser component', () => {
const onDeleteSession = vi.fn().mockResolvedValue(undefined);
const onExit = vi.fn();
const { lastFrame, waitUntilReady } = render(
const { lastFrame, waitUntilReady } = await render(
<TestSessionBrowser
config={config}
onResumeSession={onResumeSession}
@@ -254,7 +252,6 @@ describe('SessionBrowser component', () => {
testSessions={[searchSession, otherSession]}
/>,
);
await waitUntilReady();
expect(lastFrame()).toContain('Chat Sessions (2 total');
@@ -305,7 +302,7 @@ describe('SessionBrowser component', () => {
const onDeleteSession = vi.fn().mockResolvedValue(undefined);
const onExit = vi.fn();
const { lastFrame, waitUntilReady } = render(
const { lastFrame, waitUntilReady } = await render(
<TestSessionBrowser
config={config}
onResumeSession={onResumeSession}
@@ -314,7 +311,6 @@ describe('SessionBrowser component', () => {
testSessions={[session1, session2]}
/>,
);
await waitUntilReady();
expect(lastFrame()).toContain('Chat Sessions (2 total');
@@ -354,7 +350,7 @@ describe('SessionBrowser component', () => {
const onDeleteSession = vi.fn().mockResolvedValue(undefined);
const onExit = vi.fn();
const { waitUntilReady } = render(
const { waitUntilReady } = await render(
<TestSessionBrowser
config={config}
onResumeSession={onResumeSession}
@@ -363,7 +359,6 @@ describe('SessionBrowser component', () => {
testSessions={[currentSession, otherSession]}
/>,
);
await waitUntilReady();
// Active selection is at 0 (current session).
triggerKey({ name: 'enter', sequence: '\r' });
@@ -382,7 +377,7 @@ describe('SessionBrowser component', () => {
const onDeleteSession = vi.fn().mockResolvedValue(undefined);
const onExit = vi.fn();
const { lastFrame, waitUntilReady } = render(
const { lastFrame } = await render(
<TestSessionBrowser
config={config}
onResumeSession={onResumeSession}
@@ -391,7 +386,6 @@ describe('SessionBrowser component', () => {
testError="storage failure"
/>,
);
await waitUntilReady();
expect(lastFrame()).toMatchSnapshot();
});