oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1package mcpresource
2
3import (
4 "amadan.net/rastrillo/rastrillo/budget"
5 "encoding/json"
6 "os"
7 "testing"
8)
9
10func TestRoutingResourceOnly(t *testing.T) {
11 for _, q := range []struct{ method, params, want string }{
12 {"resources/list", `{}`, `{"resources":[{"mimeType":"text/plain","name":"routing-check","uri":"equipo://routing-check"}]}`},
13 {"resources/templates/list", `{}`, `{"resourceTemplates":[]}`},
14 {"resources/read", `{"uri":"equipo://routing-check"}`, `{"contents":[{"mimeType":"text/plain","text":"equipo-routing-ready","uri":"equipo://routing-check"}]}`},
15 // Captured from Codex 0.165.0 during round 2, live-1.
16 {"resources/read", `{"_meta":{"progressToken":6},"uri":"equipo://routing-check"}`, `{"contents":[{"mimeType":"text/plain","text":"equipo-routing-ready","uri":"equipo://routing-check"}]}`},
17 {"resources/read", `{"uri":"file:///workspace/private"}`, ""},
18 {"resources/read", `{"uri":"equipo://routing-check/other"}`, ""},
19 {"resources/read", `{"uri":"equipo://routing-check","path":"/home/runner"}`, ""},
20 {"resources/write", `{"uri":"equipo://routing-check","text":"changed"}`, ""},
21 } {
22 t.Run(q.method+q.params, func(t *testing.T) {
23 result, err := Result(q.method, json.RawMessage(q.params))
24 if q.want == "" {
25 if err == nil {
26 t.Fatal("invalid request accepted", result)
27 }
28 return
29 }
30 raw, marshalErr := json.Marshal(result)
31 if err != nil || marshalErr != nil || string(raw) != q.want {
32 t.Fatalf("result=%s err=%v marshal=%v", raw, err, marshalErr)
33 }
34 })
35 }
36}
37
38func TestMain(m *testing.M) { os.Exit(budget.Main(m)) }
39