MCPcopy
hub / github.com/anomalyco/opencode / test

Function test

packages/enterprise/test-debug.ts:4–38  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2import { Storage } from "./src/core/storage"
3
4async function test() {
5 const shareInfo = await Share.create({ sessionID: "test-debug-" + Date.now() })
6
7 const batch1: Share.Data[] = [
8 { type: "part", data: { id: "part1", sessionID: "session1", messageID: "msg1", type: "text", text: "Hello" } },
9 ]
10
11 const batch2: Share.Data[] = [
12 {
13 type: "part",
14 data: { id: "part1", sessionID: "session1", messageID: "msg1", type: "text", text: "Hello Updated" },
15 },
16 ]
17
18 await Share.sync({
19 share: { id: shareInfo.id, secret: shareInfo.secret },
20 data: batch1,
21 })
22
23 await Share.sync({
24 share: { id: shareInfo.id, secret: shareInfo.secret },
25 data: batch2,
26 })
27
28 const events = await Storage.list({ prefix: ["share_event", shareInfo.id] })
29 console.log("Events (raw):", events)
30 console.log("Events (reversed):", events.toReversed())
31
32 for (const event of events.toReversed()) {
33 const data = await Storage.read(event)
34 console.log("Event data (reversed order):", event, data)
35 }
36
37 await Share.remove({ id: shareInfo.id, secret: shareInfo.secret })
38}
39
40void test()

Calls 6

syncMethod · 0.80
createMethod · 0.65
listMethod · 0.65
readMethod · 0.65
removeMethod · 0.65
logMethod · 0.45

Tested by

no test coverage detected