mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
31 lines
1.3 KiB
TypeScript
31 lines
1.3 KiB
TypeScript
import { Context } from 'cordis'
|
|
import { describe, expect, it } from 'vitest'
|
|
import { Settings, settingsNamespace, type SettingsNamespace } from '@deepseek-ai/dsh-settings'
|
|
import {
|
|
DEFAULT_PREFERENCE, THEME_SETTINGS_NAMESPACE, apply,
|
|
} from '@deepseek-ai/dsh-client-ui-theme'
|
|
|
|
class MemorySettings extends Settings {
|
|
readonly writable = true
|
|
protected load(): Promise<Record<string, unknown>> { return Promise.resolve({}) }
|
|
protected persist(_ns: SettingsNamespace, _section: Record<string, unknown>): Promise<void> {
|
|
return Promise.resolve()
|
|
}
|
|
}
|
|
|
|
describe('ui-theme host', () => {
|
|
it('registers, validates, and disposes the durable theme namespace with its fiber', async () => {
|
|
const ctx = new Context()
|
|
await ctx.plugin(MemorySettings).await()
|
|
const fiber = ctx.plugin({ apply })
|
|
await fiber.await()
|
|
const ns = settingsNamespace(THEME_SETTINGS_NAMESPACE)
|
|
expect(ctx.settings.get(ns)).toEqual({ preference: DEFAULT_PREFERENCE })
|
|
await ctx.settings.update(ns, { preference: 'dark' })
|
|
expect(ctx.settings.get(ns)).toEqual({ preference: 'dark' })
|
|
await expect(ctx.settings.update(ns, { preference: 'sepia' })).rejects.toThrow()
|
|
await fiber.dispose()
|
|
expect(ctx.settings.describe().map(row => row.ns)).not.toContain(ns)
|
|
})
|
|
})
|