Repository navigation
Expand file tree
/
Copy pathhelpme.test.ts
More file actions
56 lines (50 loc) · 1.92 KB
/
Copy pathhelpme.test.ts
File metadata and controls
56 lines (50 loc) · 1.92 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
import { describe, expect } from "bun:test"
import { LayerNode } from "@opencode-ai/core/effect/layer-node"
import { CrossSpawnSpawner } from "@opencode-ai/core/cross-spawn-spawner"
import { Effect, Layer } from "effect"
import { Command } from "../../src/command"
import { TestInstance, testInstanceStoreLayer } from "../fixture/fixture"
import { testEffect } from "../lib/effect"
const it = testEffect(
Layer.mergeAll(LayerNode.compile(Command.node), LayerNode.compile(CrossSpawnSpawner.node), testInstanceStoreLayer),
)
describe("helpMe", () => {
it.instance("is registered as a built-in command", () =>
Effect.gen(function* () {
const command = yield* Command.Service
const helpMe = yield* command.get(Command.Default.HELPME)
expect(helpMe).toBeDefined()
}),
)
it.instance("has a template", () =>
Effect.gen(function* () {
const command = yield* Command.Service
const helpMe = yield* command.get(Command.Default.HELPME)
expect(helpMe?.template).toBeDefined()
}),
)
it.instance("has hints", () =>
Effect.gen(function* () {
const command = yield* Command.Service
const helpMe = yield* command.get(Command.Default.HELPME)
expect(helpMe?.hints).toBeDefined()
}),
)
it.instance("has a description", () =>
Effect.gen(function* () {
const command = yield* Command.Service
const helpMe = yield* command.get(Command.Default.HELPME)
expect(helpMe?.description).toBeDefined()
}),
)
it.instance("model instructed to never edit files", () =>
Effect.gen(function* () {
const command = yield* Command.Service
const helpMe = yield* command.get(Command.Default.HELPME)
const template = yield* Effect.promise(() =>
Promise.resolve(helpMe?.template),
)
expect(template?.includes("This is a read only task. Do not create, edit, or delete any files. Only read files.")).toBe(true)
}),
)
})