skillhub/plugins/dsh/test/search-result.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

30 lines
1.5 KiB
TypeScript

import { describe, expect, test } from 'bun:test';
import type { ConversationSearchResult } from '../src/host/search-tool.ts';
import { parseSearchResult } from '../src/client/search-result.ts';
const snapshot = {
schemaVersion: 1, kind: 'skillhub-search', query: 'pdf',
sourceRevision: '01900000-0000-4000-8000-000000000001', sourceLabel: 'https://registry.example',
createdAt: '2026-10-13T00:00:00Z', total: 1, returned: 1, limit: 20,
items: [{ namespace: 'team', slug: 'pdf', latestVersion: '1.0.0', summary: 'Read PDF',
selectionRef: '01900000-0000-4000-8000-000000000002' }],
} satisfies ConversationSearchResult;
describe('persisted search card boundary', () => {
test('preserves the original source, timestamp and fixed version', () => {
expect(parseSearchResult(snapshot)).toEqual(snapshot);
});
test.each([
{ ...snapshot, schemaVersion: 2 },
{ ...snapshot, returned: 0 },
{ ...snapshot, total: 0 },
{ ...snapshot, sourceLabel: 'javascript:alert(1)' },
{ ...snapshot, sourceLabel: 'https://user:secret@example.com' },
{ ...snapshot, sourceLabel: 'https://example.com?token=secret' },
{ ...snapshot, items: [{ ...snapshot.items[0], path: '/private' }] },
{ ...snapshot, items: [{ ...snapshot.items[0], selectionRef: 'untrusted' }] },
{ ...snapshot, createdAt: 'yesterday' },
null,
])('rejects unsupported or malformed history without guessing an action', value => {
expect(parseSearchResult(value)).toBeUndefined();
});
});