plugin-shape.spec.ts 815 B

12345678910111213141516171819
  1. import { describe, expect, it } from 'vitest'
  2. import Loader from '@cordisjs/plugin-loader'
  3. import * as stdio from '../src/index.ts'
  4. /** Real Loader export-path guard for the namespace stdio plugin. */
  5. describe('dsh-stdio plugin export shape', () => {
  6. it('preserves name, inject, Config, and apply through Loader unwrapping', () => {
  7. expect('default' in stdio).toBe(false)
  8. expect(typeof stdio.apply).toBe('function')
  9. const loader = Object.create(Loader.prototype) as Loader
  10. const unwrapped = loader.unwrapExports(stdio) as Record<string, unknown>
  11. expect(unwrapped).toBe(stdio)
  12. expect(unwrapped.name).toBe('ui-stdio')
  13. expect(unwrapped.inject).toEqual(['agents', 'userInteraction'])
  14. expect(unwrapped.Config).toBeDefined()
  15. expect(typeof unwrapped.apply).toBe('function')
  16. })
  17. })