mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-09-09 04:02:35 +00:00
35 lines
1.0 KiB
TypeScript
35 lines
1.0 KiB
TypeScript
// @vitest-environment jsdom
|
|
import { afterEach, describe, expect, it } from 'vitest'
|
|
import { cleanup, render } from '@testing-library/react'
|
|
import { Context } from '@deepseek-ai/cordis'
|
|
import { SlotTestRuntime } from '@deepseek-ai/dsh-client-test-runtime'
|
|
import { buildRenderApp } from '../src/client/app.tsx'
|
|
|
|
let runtime: SlotTestRuntime | undefined
|
|
|
|
afterEach(async () => {
|
|
cleanup()
|
|
await runtime?.dispose()
|
|
runtime = undefined
|
|
})
|
|
|
|
async function bench() {
|
|
runtime = await SlotTestRuntime.create()
|
|
await runtime.root.declare({}, () => <div data-testid="frame" />)
|
|
return { runtime, renderApp: buildRenderApp({ ctx: runtime.ctx }) }
|
|
}
|
|
|
|
describe('buildRenderApp', () => {
|
|
it('fails loud when the slot registry is unavailable', () => {
|
|
const renderApp = buildRenderApp({ ctx: new Context() })
|
|
expect(() => renderApp()).toThrow()
|
|
})
|
|
|
|
it('renders the root slot tree', async () => {
|
|
const b = await bench()
|
|
const view = render(<>{b.renderApp()}</>)
|
|
expect(view.getByTestId('frame')).toBeTruthy()
|
|
})
|
|
|
|
})
|