forked from llessi06/opencode-llama.cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.ts
More file actions
50 lines (42 loc) · 1.21 KB
/
test.ts
File metadata and controls
50 lines (42 loc) · 1.21 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
// Test script to verify the plugin exports correctly
import { LlamaCppPlugin } from "./src"
import {PluginInput} from "@opencode-ai/plugin";
// Log the imported value
console.log("Plugin type:", typeof LlamaCppPlugin)
// Try to call it if it's a function
if (typeof LlamaCppPlugin === "function") {
console.log("✓ Plugin is a function")
} else {
console.error("✗ Plugin is not a function")
process.exit(1)
}
// Test that it can be called (mock input)
const mockInput = {
client: {} as any,
project: {} as any,
directory: "/tmp",
worktree: "/tmp",
$: {} as any,
}
LlamaCppPlugin(<PluginInput>mockInput)
.then((hooks) => {
console.log("✓ Plugin initializes successfully")
console.log("Hooks returned:", Object.keys(hooks))
if (hooks.config) {
console.log("✓ Config hook exists")
} else {
console.error("✗ Config hook missing")
process.exit(1)
}
if (hooks.event) {
console.log("✓ Event hook exists")
} else {
console.error("✗ Event hook missing")
process.exit(1)
}
console.log("\n✅ All tests passed!")
})
.catch((error) => {
console.error("✗ Plugin initialization failed:", error)
process.exit(1)
})