-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopencode-plugin.test.js
More file actions
81 lines (63 loc) · 2.49 KB
/
Copy pathopencode-plugin.test.js
File metadata and controls
81 lines (63 loc) · 2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import test from 'node:test';
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import { ArchAIAgentWorkflowsPlugin } from './opencode-plugin.js';
test('plugin config registers Playwright MCP automatically when missing', async () => {
const plugin = await ArchAIAgentWorkflowsPlugin();
const config = {};
await plugin.config(config);
assert.deepEqual(config.mcp.playwright, {
type: 'local',
command: ['npx', '-y', '@playwright/mcp'],
enabled: true,
});
});
test('plugin config preserves existing Playwright MCP when user configured it', async () => {
const plugin = await ArchAIAgentWorkflowsPlugin();
const existing = {
type: 'local',
command: ['custom-playwright'],
enabled: false,
};
const config = { mcp: { playwright: existing } };
await plugin.config(config);
assert.equal(config.mcp.playwright, existing);
});
test('plugin config registers Chrome DevTools MCP automatically when missing', async () => {
const plugin = await ArchAIAgentWorkflowsPlugin();
const config = {};
await plugin.config(config);
assert.deepEqual(config.mcp['chrome-devtools'], {
type: 'local',
command: ['npx', '-y', 'chrome-devtools-mcp'],
enabled: true,
});
});
test('plugin config preserves existing Chrome DevTools MCP when user configured it', async () => {
const plugin = await ArchAIAgentWorkflowsPlugin();
const existing = {
type: 'local',
command: ['custom-chrome-devtools'],
enabled: false,
};
const config = { mcp: { 'chrome-devtools': existing } };
await plugin.config(config);
assert.equal(config.mcp['chrome-devtools'], existing);
});
test('plugin config auto-registers bundled superpowers skills path when available', async () => {
const plugin = await ArchAIAgentWorkflowsPlugin();
const config = { skills: { paths: [] } };
await plugin.config(config);
const superpowersPath = config.skills.paths.find((item) => item.endsWith(path.join('superpowers', 'skills')));
assert.ok(superpowersPath, 'expected bundled superpowers skills path');
assert.ok(fs.existsSync(superpowersPath));
});
test('plugin config does not duplicate superpowers skills path', async () => {
const plugin = await ArchAIAgentWorkflowsPlugin();
const config = { skills: { paths: [] } };
await plugin.config(config);
await plugin.config(config);
const superpowersPaths = config.skills.paths.filter((item) => item.endsWith(path.join('superpowers', 'skills')));
assert.equal(superpowersPaths.length, 1);
});