forked from Ikalus1988/MisakaNet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstallation-methods.test.js
More file actions
124 lines (99 loc) · 4 KB
/
Copy pathinstallation-methods.test.js
File metadata and controls
124 lines (99 loc) · 4 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
const { describe, it, before, after } = require('mocha');
const { expect } = require('chai');
const { execSync } = require('child_process');
const fs = require('fs');
const path = require('path');
const os = require('os');
describe('MisakaNet dsh Plugin Installation Methods', function() {
this.timeout(120000);
const skillsDir = path.join(os.homedir(), '.dsh', 'skills');
const pluginDir = path.join(skillsDir, 'misakanet');
function cleanup() {
try { execSync('dsh plugin remove misakanet', { stdio: 'ignore' }); } catch (e) {}
try { fs.rmSync(pluginDir, { recursive: true, force: true }); } catch (e) {}
}
describe('Method 1: npm plugin market', function() {
before(cleanup);
it('should install successfully via npm', function() {
const result = execSync('dsh plugin add misakanet', { encoding: 'utf8', timeout: 60000 });
expect(result).to.not.be.empty;
});
it('should appear in plugin list', function() {
const result = execSync('dsh plugin list', { encoding: 'utf8' });
expect(result).to.include('misakanet');
});
it('should create plugin directory', function() {
expect(fs.existsSync(pluginDir)).to.be.true;
});
it('should have MCP tools accessible', function() {
const result = execSync('dsh tool list', { encoding: 'utf8' });
expect(result).to.include('misakanet');
});
after(cleanup);
});
describe('Method 2: git method', function() {
before(cleanup);
it('should install successfully via git', function() {
const result = execSync(
'dsh plugin add github:Ikalus1988/MisakaNet',
{ encoding: 'utf8', timeout: 60000 }
);
expect(result).to.not.be.empty;
});
it('should appear in plugin list', function() {
const result = execSync('dsh plugin list', { encoding: 'utf8' });
expect(result).to.include('misakanet');
});
it('should have MCP tools accessible', function() {
const result = execSync('dsh tool list', { encoding: 'utf8' });
expect(result).to.include('misakanet');
});
after(cleanup);
});
describe('Method 3: manual skill discovery', function() {
before(cleanup);
it('should install successfully via manual copy', function() {
if (!fs.existsSync(skillsDir)) {
fs.mkdirSync(skillsDir, { recursive: true });
}
const sourceDir = path.join(__dirname, '..', 'skills', 'misakanet');
// fs.cpSync (Node >=16.7) — no shell string, so no command injection
// from env-derived paths (CodeQL js/shell-command-injection-from-environment).
fs.cpSync(sourceDir, pluginDir, { recursive: true });
});
it('should appear in plugin list', function() {
const result = execSync('dsh plugin list', { encoding: 'utf8' });
expect(result).to.include('misakanet');
});
after(cleanup);
});
describe('Conflict test', function() {
before(cleanup);
it('should not conflict when switching methods', function() {
// Install via npm
execSync('dsh plugin add misakanet', { stdio: 'ignore', timeout: 60000 });
let list = execSync('dsh plugin list', { encoding: 'utf8' });
expect(list).to.include('misakanet');
// Remove and reinstall via git
execSync('dsh plugin remove misakanet', { stdio: 'ignore' });
execSync('dsh plugin add github:Ikalus1988/MisakaNet', { stdio: 'ignore', timeout: 60000 });
list = execSync('dsh plugin list', { encoding: 'utf8' });
expect(list).to.include('misakanet');
});
after(cleanup);
});
describe('Uninstall test', function() {
before(function() {
cleanup();
execSync('dsh plugin add misakanet', { stdio: 'ignore', timeout: 60000 });
});
it('should uninstall cleanly', function() {
execSync('dsh plugin remove misakanet');
const result = execSync('dsh plugin list', { encoding: 'utf8' });
expect(result).to.not.include('misakanet');
});
it('should remove plugin directory', function() {
expect(fs.existsSync(pluginDir)).to.be.false;
});
});
});