Skip to content

Commit 5c83c47

Browse files
committed
refactor(test): consolidate plugin-install tests into single file
Merge plugin-install-simplified.test.ts into plugin-install.test.ts. All tests now focus on the zero-config Claude Code marketplace integration workflow. Removes duplicate test files and simplifies test organization.
1 parent b41eb4b commit 5c83c47

File tree

2 files changed

+71
-67
lines changed

2 files changed

+71
-67
lines changed

tests/commands/plugin-install-simplified.test.ts

Lines changed: 0 additions & 67 deletions
This file was deleted.
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
2+
import { mkdir, mkdtemp, rm } from 'node:fs/promises';
3+
import { tmpdir } from 'node:os';
4+
import { join } from 'node:path';
5+
import { pluginInstall } from '../../src/commands/plugin-install';
6+
import { fileExists } from '../../src/helpers/fs';
7+
8+
describe('plugin-install', () => {
9+
let testDir: string;
10+
11+
beforeEach(async () => {
12+
testDir = await mkdtemp(join(tmpdir(), 'aipm-test-'));
13+
await mkdir(join(testDir, '.cursor'), { recursive: true });
14+
});
15+
16+
afterEach(async () => {
17+
await rm(testDir, { recursive: true, force: true });
18+
});
19+
20+
describe('Claude Code marketplace integration (zero-config)', () => {
21+
test('should install a plugin from Claude Code without init', async () => {
22+
// AIPM auto-discovers Claude Code marketplaces without requiring configuration
23+
// No .aipm/ directory needed
24+
const options = {
25+
pluginId: 'document-skills@claude/anthropic-agent-skills',
26+
cwd: testDir,
27+
};
28+
29+
await pluginInstall(options);
30+
31+
// Verify skills were synced to .cursor/
32+
const skillsDir = join(testDir, '.cursor', 'skills');
33+
expect(await fileExists(skillsDir)).toBe(true);
34+
35+
// Verify each skill gets its own flattened directory (no nesting)
36+
// Addresses Claude Code limitation with nested skill directories
37+
const xlsxSkillDir = join(skillsDir, 'aipm-claude-anthropic-agent-skills-document-skills-xlsx');
38+
expect(await fileExists(xlsxSkillDir)).toBe(true);
39+
40+
// Verify internal structure is preserved within the skill
41+
const skillMd = join(xlsxSkillDir, 'SKILL.md');
42+
expect(await fileExists(skillMd)).toBe(true);
43+
});
44+
45+
test('should error if marketplace not found in Claude Code', async () => {
46+
const options = {
47+
pluginId: 'some-plugin@claude/nonexistent-marketplace',
48+
cwd: testDir,
49+
};
50+
51+
await expect(pluginInstall(options)).rejects.toThrow(
52+
"Marketplace 'claude/nonexistent-marketplace' not found in Claude Code",
53+
);
54+
});
55+
56+
test('should work from any directory without project setup', async () => {
57+
// Zero-config means no .aipm/ directory or initialization needed
58+
const options = {
59+
pluginId: 'example-skills@claude/anthropic-agent-skills',
60+
cwd: testDir,
61+
};
62+
63+
// Should succeed without any config files or aipm init
64+
await pluginInstall(options);
65+
66+
// Verify the plugin was installed to .cursor/
67+
const skillsDir = join(testDir, '.cursor', 'skills');
68+
expect(await fileExists(skillsDir)).toBe(true);
69+
});
70+
});
71+
});

0 commit comments

Comments
 (0)