mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
fix failed test
This commit is contained in:
@@ -158,21 +158,23 @@ describe('useResumeCommand', () => {
|
|||||||
});
|
});
|
||||||
expect(result.current.isResumeDialogOpen).toBe(true);
|
expect(result.current.isResumeDialogOpen).toBe(true);
|
||||||
|
|
||||||
const resumePromise = act(async () => {
|
let resumePromise: Promise<void> | undefined;
|
||||||
// Intentionally do not resolve loadSession yet.
|
act(() => {
|
||||||
await result.current.handleResume('session-2');
|
// Start resume but do not await it yet — we want to assert the dialog
|
||||||
|
// closes immediately before the async session load completes.
|
||||||
|
resumePromise = result.current.handleResume('session-2') as unknown as
|
||||||
|
| Promise<void>
|
||||||
|
| undefined;
|
||||||
});
|
});
|
||||||
|
|
||||||
// After the first flush, the dialog should already be closed even though
|
|
||||||
// the session load is still pending.
|
|
||||||
await act(async () => {});
|
|
||||||
expect(result.current.isResumeDialogOpen).toBe(false);
|
expect(result.current.isResumeDialogOpen).toBe(false);
|
||||||
|
|
||||||
// Now finish the async load and let the handler complete.
|
// Now finish the async load and let the handler complete.
|
||||||
resumeMocks.resolvePendingLoadSession({
|
resumeMocks.resolvePendingLoadSession({
|
||||||
conversation: [{ role: 'user', parts: [{ text: 'hello' }] }],
|
conversation: [{ role: 'user', parts: [{ text: 'hello' }] }],
|
||||||
});
|
});
|
||||||
await resumePromise;
|
await act(async () => {
|
||||||
|
await resumePromise;
|
||||||
|
});
|
||||||
|
|
||||||
expect(config.startNewSession).toHaveBeenCalledWith(
|
expect(config.startNewSession).toHaveBeenCalledWith(
|
||||||
'session-2',
|
'session-2',
|
||||||
|
|||||||
Reference in New Issue
Block a user