mirror of
https://github.com/stablyai/orca.git
synced 2026-10-31 00:57:45 +00:00
test(native-chat): unmount the cut-turn notice hooks after each test (#27358)
A rendered hook left mounted can commit after happy-dom is torn down, which fails the shard with "window is not defined" from React's scheduler. Co-authored-by: m4air <m4air@Mac.localdomain> Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
+5
-2
@@ -1,7 +1,7 @@
|
||||
// @vitest-environment happy-dom
|
||||
|
||||
import { renderHook } from '@testing-library/react'
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import { cleanup, renderHook } from '@testing-library/react'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import type { AgentJournalRenderItem } from '../../../../shared/agent-session-journal-types'
|
||||
|
||||
const SCOPE = { kind: 'turn' as const, turnItemId: 'turn-1' }
|
||||
@@ -74,6 +74,9 @@ vi.mock('./use-structured-agent-session-sends', () => ({
|
||||
import { useStructuredAgentSession } from './use-structured-agent-session'
|
||||
|
||||
describe('useStructuredAgentSession transcript', () => {
|
||||
// A root left mounted can commit after happy-dom is torn down ("window is not defined").
|
||||
afterEach(cleanup)
|
||||
|
||||
it('shows a cut turn no row explains with its one notice, placed in that turn', () => {
|
||||
const { result } = renderHook(() =>
|
||||
useStructuredAgentSession({
|
||||
|
||||
Reference in New Issue
Block a user