load-path.spec.ts 1.1 KB

123456789101112131415161718192021222324
  1. /**
  2. * Loader export-shape guard for @deepseek-ai/dsh-tool-lsp. It is a NAMESPACE plugin with `inject`, so a
  3. * stray `export default apply` would make the Loader's `unwrapExports` collapse the module to the
  4. * bare `apply`, dropping `inject` (postmortem 0001). This verifies the namespace survives
  5. * `Loader.prototype.unwrapExports`; the `lsp-definition` ACP snapshot owns full app composition.
  6. */
  7. import { describe, expect, it } from 'vitest'
  8. import Loader from '@cordisjs/plugin-loader'
  9. import * as toolLsp from '@deepseek-ai/dsh-tool-lsp'
  10. describe('dsh-tool-lsp Loader export-shape guard', () => {
  11. it('has no default export and keeps name/inject/Config through unwrapExports', () => {
  12. expect('default' in toolLsp).toBe(false)
  13. const loader = Object.create(Loader.prototype) as Loader
  14. const unwrapped = loader.unwrapExports(toolLsp) as Record<string, unknown>
  15. expect(unwrapped).toBe(toolLsp)
  16. expect(unwrapped.name).toBe('tool-lsp')
  17. expect(unwrapped.inject).toEqual(['tools', 'lsp', 'systemPrompt'])
  18. expect(typeof unwrapped.apply).toBe('function')
  19. expect(unwrapped.Config).toBeDefined()
  20. })
  21. })