Open History to see the last commit
1import { describe, expect, it } from 'vitest'
2import {
3 makeFakeShellSpawn,
4 runJournalConformance,
5 runSandboxCheckpointForkConformance,
6 runSandboxCheckpointStoreConformance,
7 runTakeoverConformance,
8} from '@tanstack/ai-sandbox/testkit'
9import { memorySandboxSnapshots } from '@tanstack/ai-sandbox'
10
11runSandboxCheckpointForkConformance(
12 'published testkit consumer',
13 memorySandboxSnapshots,
14)
15
16/**
17 * Proves the `@tanstack/ai-sandbox/testkit` subpath resolves as a consumer
18 * would resolve it.
19 */
20describe('@tanstack/ai-sandbox/testkit subpath', () => {
21 it('ships the provider and checkpoint conformance suites', () => {
22 expect(typeof runJournalConformance).toBe('function')
23 expect(typeof runSandboxCheckpointForkConformance).toBe('function')
24 expect(typeof runSandboxCheckpointStoreConformance).toBe('function')
25 expect(typeof runTakeoverConformance).toBe('function')
26 })
27
28 it('exports a working makeFakeShellSpawn', async () => {
29 const spawn = makeFakeShellSpawn()
30 await spawn.stdin.write('pwd; echo hi\n')
31 const first = await spawn.stdout[Symbol.asyncIterator]().next()
32 expect(first).toEqual({ value: '/workspace\n', done: false })
33 await spawn.stdin.end()
34 expect(await spawn.wait()).toBe(0)
35 })
36})