-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify.js
More file actions
85 lines (70 loc) · 2.34 KB
/
Copy pathverify.js
File metadata and controls
85 lines (70 loc) · 2.34 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
/**
* Quick verification script for memory plugin
*/
console.log('🔍 Verifying Memory Plugin...\n');
const checks = [];
// Check 1: Module loading
try {
const config = require('./config');
const storage = require('./storage');
const manager = require('./memory-manager');
const plugin = require('./index');
checks.push({ name: 'Module Loading', status: '✅ PASS' });
} catch (e) {
checks.push({ name: 'Module Loading', status: '❌ FAIL', error: e.message });
}
// Check 2: Config validation
try {
const { validateConfig } = require('./config');
const config = validateConfig();
if (config.storagePath && config.maxHistoryItems) {
checks.push({ name: 'Config Validation', status: '✅ PASS' });
} else {
checks.push({ name: 'Config Validation', status: '❌ FAIL' });
}
} catch (e) {
checks.push({ name: 'Config Validation', status: '❌ FAIL', error: e.message });
}
// Check 3: Storage operations
try {
const { MemoryStorage } = require('./storage');
const path = require('path');
const fs = require('fs').promises;
const testFile = path.join(__dirname, 'verify-test.json');
const storage = new MemoryStorage(testFile);
(async () => {
await storage.initialize();
storage.set('test.key', 'value');
await storage.save();
const val = storage.get('test.key');
await fs.unlink(testFile);
if (val === 'value') {
checks.push({ name: 'Storage Operations', status: '✅ PASS' });
} else {
checks.push({ name: 'Storage Operations', status: '❌ FAIL' });
}
printResults();
})();
} catch (e) {
checks.push({ name: 'Storage Operations', status: '❌ FAIL', error: e.message });
printResults();
}
function printResults() {
console.log('\n📊 Verification Results:\n');
checks.forEach(check => {
console.log(` ${check.status} ${check.name}`);
if (check.error) {
console.log(` Error: ${check.error}`);
}
});
const passed = checks.filter(c => c.status.includes('PASS')).length;
const total = checks.length;
console.log(`\n${'='.repeat(50)}`);
console.log(`Total: ${passed}/${total} checks passed`);
if (passed === total) {
console.log('\n✨ All verifications passed! Plugin is ready to use.\n');
} else {
console.log('\n⚠️ Some checks failed. Please review the errors above.\n');
process.exit(1);
}
}