agent-ecosystem/test/main/services/extensions/SkillReviewService.test.ts
iliya 4b4dccd13d feat: add skills management features and integrate skills API
- Introduced skills catalog management with functionalities to list, get details, preview, and apply skill changes.
- Implemented IPC handlers for skills-related actions, enhancing communication between renderer and main processes.
- Updated the UI to include a dedicated Skills panel within the extension store, improving user access to skills management.
- Added new constants and types for skills API integration, ensuring a structured approach to skills handling.
- Enhanced state management to support skills loading, error handling, and detail fetching.
2026-03-11 21:46:56 +02:00

32 lines
1.2 KiB
TypeScript

import * as fs from 'node:fs/promises';
import * as os from 'node:os';
import * as path from 'node:path';
import { afterEach, describe, expect, it } from 'vitest';
import { SkillReviewService } from '@main/services/extensions/skills/SkillReviewService';
describe('SkillReviewService', () => {
const createdDirs: string[] = [];
afterEach(async () => {
await Promise.all(createdDirs.splice(0).map((dir) => fs.rm(dir, { recursive: true, force: true })));
});
it('builds create/update review preview correctly', async () => {
const service = new SkillReviewService();
const targetDir = await fs.mkdtemp(path.join(os.tmpdir(), 'skill-review-'));
createdDirs.push(targetDir);
await fs.mkdir(path.join(targetDir, 'scripts'), { recursive: true });
await fs.writeFile(path.join(targetDir, 'SKILL.md'), '# old', 'utf8');
const changes = await service.buildTextChanges(targetDir, [
{ relativePath: 'SKILL.md', content: '# new' },
{ relativePath: 'scripts/run.sh', content: 'echo hi' },
]);
expect(changes.find((change) => change.relativePath === 'SKILL.md')?.action).toBe('update');
expect(changes.find((change) => change.relativePath === 'scripts/run.sh')?.action).toBe('create');
});
});