skillhub/plugins/dsh/test/ui-availability.test.ts
XiaoSeS 3560679793
Some checks failed
Deploy Docs / build (push) Has been cancelled
Security / Dependency Review (push) Has been cancelled
Security / CodeQL (java-kotlin) (push) Has been cancelled
Security / CodeQL (javascript-typescript) (push) Has been cancelled
Security / CodeQL (python) (push) Has been cancelled
Deploy Docs / Deploy (push) Has been cancelled
feat(dsh): add native SkillHub plugin for DeepSeek Harness (#956)
Add the native SkillHub plugin for DeepSeek Harness with a scoped skill center, conversation search/install tools, exact-version installation and protected lifecycle management. Prepare the independently versioned 0.1.0 npm candidate with an empty default Registry and documented compatibility limits.

Keep formal specifications and executable regression tests; remove archived development screenshots and runtime reports from the final tree. Review fixes cover independent scopes, installed references, pre-staging recovery and idempotent discovery.

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-10-16 19:22:26 +08:00

27 lines
1.6 KiB
TypeScript

import { expect, test } from 'bun:test';
import { UiAvailability, unavailableEntries } from '../src/client/ui-availability.js';
test('entry degradation reports missing surfaces and recovers without stale notices', () => {
const availability = new UiAvailability();
const changes: unknown[] = [];
const unsubscribe = availability.subscribe(() => changes.push(availability.getSnapshot()));
const entries = ['main', 'sidebar', 'conversation', 'configuration'] as const;
const removers = entries.map(entry => availability.enable(entry));
expect(unavailableEntries(availability.getSnapshot())).toEqual([]);
const complete = availability.getSnapshot();
removers[2]!();
expect(unavailableEntries(availability.getSnapshot())).toEqual(['对话技能卡片暂不可用,可在技能广场浏览和管理技能。']);
expect(complete.conversation).toBe(true);
const restoreConversation = availability.enable('conversation');
expect(unavailableEntries(availability.getSnapshot())).toEqual([]);
removers[0]!(); removers[1]!();
expect(unavailableEntries(availability.getSnapshot())).toEqual(['技能广场入口暂不可用,可继续使用对话中的技能卡片。']);
removers[3]!();
expect(unavailableEntries(availability.getSnapshot())).toContain('配置入口暂不可用,当前来源设置保持不变。');
const before = changes.length;
removers[3]!();
expect(changes).toHaveLength(before);
unsubscribe(); restoreConversation();
expect(changes).toHaveLength(before);
expect(unavailableEntries(availability.getSnapshot()).slice(0, 2)).toEqual(['技能广场入口暂不可用。', '对话技能卡片暂不可用。']);
});