| 1234567891011121314151617181920 |
- import { Context } from '@deepseek-ai/cordis'
- import type { Agent } from '@deepseek-ai/dsh-agent'
- import type { FileReferenceCandidate } from '@deepseek-ai/dsh-file-reference/types'
- import { describe, expect, it, vi } from 'vitest'
- import { SessionFileReferences } from '../src/file-references.ts'
- describe('SessionFileReferences', () => {
- it('delegates the resolved Agent, query, and cancellation signal unchanged', async () => {
- const ctx = new Context()
- const candidates: FileReferenceCandidate[] = [{ path: 'src', kind: 'directory' }]
- const list = vi.fn(() => Promise.resolve(candidates))
- ctx.provide('fileReferences', { list } as never)
- const adapter = new SessionFileReferences(ctx)
- const agent = { id: 'target' } as unknown as Agent
- const signal = new AbortController().signal
- await expect(adapter.list(agent, 'sr', signal)).resolves.toBe(candidates)
- expect(list).toHaveBeenCalledWith(agent, 'sr', signal)
- })
- })
|