mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
test(spill-policy): guard loader export shape
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import { Context } from 'cordis'
|
||||
import Loader from '@cordisjs/plugin-loader'
|
||||
import { CallId } from '@deepseek-ai/dsh-llm'
|
||||
import type { ContentBlock } from '@deepseek-ai/dsh-llm'
|
||||
import { SessionId } from '@deepseek-ai/dsh-session'
|
||||
@@ -82,6 +83,20 @@ describe('disabled mode', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('loader export shape', () => {
|
||||
it('has no default export and keeps name/inject/Config through unwrapExports', () => {
|
||||
expect('default' in SpillPolicy).toBe(false)
|
||||
|
||||
const loader = Object.create(Loader.prototype) as Loader
|
||||
const unwrapped = loader.unwrapExports(SpillPolicy) as Record<string, unknown>
|
||||
expect(unwrapped).toBe(SpillPolicy)
|
||||
expect(unwrapped.name).toBe('spill-policy')
|
||||
expect(unwrapped.inject).toEqual(['tools'])
|
||||
expect(unwrapped.Config).toBeDefined()
|
||||
expect(typeof unwrapped.apply).toBe('function')
|
||||
})
|
||||
})
|
||||
|
||||
describe('config validation', () => {
|
||||
it('rejects a negative maxInlineBytes at load', async () => {
|
||||
await expect(setup({ maxInlineBytes: -1 })).rejects.toThrow(/non-negative integer/)
|
||||
|
||||
Reference in New Issue
Block a user