mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
The browse interaction also presents a dialog (the in-app modal), so 'dialog' failed to discriminate the two capability kinds; 'native' names where the chooser runs. Package directory-picker-dialog -> directory-picker-native, kind 'dialog' -> 'native', with every seam/gateway/client/doc reference updated and the seam Agent Note's naming rationale rewritten to match.
36 lines
1.5 KiB
TypeScript
36 lines
1.5 KiB
TypeScript
/** Contract behavior the seam itself owns: registration identity and typed failures. */
|
|
|
|
import { describe, expect, it } from 'vitest'
|
|
import { Context } from 'cordis'
|
|
import { DirectoryPicker, DirectoryPickerError } from '../src/index.ts'
|
|
import type { DirectoryPickerCapability } from '../src/index.ts'
|
|
|
|
/** Minimal concrete backend: all a subclass owes the abstract class is capability(). */
|
|
class StubPicker extends DirectoryPicker {
|
|
private readonly stub: DirectoryPickerCapability = { kind: 'native', pick: async () => null }
|
|
capability(): DirectoryPickerCapability {
|
|
return this.stub
|
|
}
|
|
}
|
|
|
|
describe('DirectoryPicker seam', () => {
|
|
it('registers a subclass as ctx.directoryPicker and leaves with its fiber', async () => {
|
|
const ctx = new Context()
|
|
const fiber = ctx.plugin(StubPicker)
|
|
await fiber.await()
|
|
expect(ctx.get('directoryPicker')).toBeInstanceOf(StubPicker)
|
|
expect(ctx.get('directoryPicker')!.capability().kind).toBe('native')
|
|
await fiber.dispose()
|
|
expect(ctx.get('directoryPicker')).toBeUndefined()
|
|
})
|
|
|
|
it('carries the business code and subject path on DirectoryPickerError', () => {
|
|
const failure = new DirectoryPickerError('directory-exists', '/home/u/x', '/home/u/x already exists')
|
|
expect(failure.name).toBe('DirectoryPickerError')
|
|
expect(failure.code).toBe('directory-exists')
|
|
expect(failure.path).toBe('/home/u/x')
|
|
expect(failure.message).toContain('already exists')
|
|
expect(failure).toBeInstanceOf(Error)
|
|
})
|
|
})
|