plugin-shape.spec.ts 943 B

1234567891011121314151617181920212223242526272829
  1. import { describe, expect, it } from 'vitest'
  2. import Loader from '@cordisjs/plugin-loader'
  3. import * as tui from '../src/index.ts'
  4. /** Real Loader export-path guard for the namespace TUI plugin. */
  5. describe('dsh-tui plugin export shape', () => {
  6. it('preserves name, inject, Config, and apply through Loader unwrapping', () => {
  7. expect('default' in tui).toBe(false)
  8. expect(typeof tui.apply).toBe('function')
  9. const loader = Object.create(Loader.prototype) as Loader
  10. const unwrapped = loader.unwrapExports(tui) as Record<string, unknown>
  11. expect(unwrapped).toBe(tui)
  12. expect(unwrapped.name).toBe('ui-tui')
  13. expect(unwrapped.inject).toEqual([
  14. 'agents',
  15. 'sessions',
  16. 'commands',
  17. 'userInteraction',
  18. 'tools',
  19. 'llm',
  20. 'systemPrompt',
  21. 'tokenMeter',
  22. 'tuiPrompt',
  23. ])
  24. expect(unwrapped.Config).toBeDefined()
  25. expect(typeof unwrapped.apply).toBe('function')
  26. })
  27. })