file-references.host.spec.ts 961 B

1234567891011121314151617181920
  1. import { Context } from '@deepseek-ai/cordis'
  2. import type { Agent } from '@deepseek-ai/dsh-agent'
  3. import type { FileReferenceCandidate } from '@deepseek-ai/dsh-file-reference/types'
  4. import { describe, expect, it, vi } from 'vitest'
  5. import { SessionFileReferences } from '../src/file-references.ts'
  6. describe('SessionFileReferences', () => {
  7. it('delegates the resolved Agent, query, and cancellation signal unchanged', async () => {
  8. const ctx = new Context()
  9. const candidates: FileReferenceCandidate[] = [{ path: 'src', kind: 'directory' }]
  10. const list = vi.fn(() => Promise.resolve(candidates))
  11. ctx.provide('fileReferences', { list } as never)
  12. const adapter = new SessionFileReferences(ctx)
  13. const agent = { id: 'target' } as unknown as Agent
  14. const signal = new AbortController().signal
  15. await expect(adapter.list(agent, 'sr', signal)).resolves.toBe(candidates)
  16. expect(list).toHaveBeenCalledWith(agent, 'sr', signal)
  17. })
  18. })