跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

浏览文件

profile_relay_test.go

34 行 · 992 B历史下载
1package main
2
3import (
4 "os"
5 "path/filepath"
6 "testing"
7
8 "github.com/sylvinus/agent-vm/internal/mobilelink"
9)
10
11func TestNewPairingUsesDesktopRelay(t *testing.T) {
12 dir := t.TempDir()
13 config := filepath.Join(dir, "config.json")
14 prefs := filepath.Join(dir, "workbench.json")
15 for _, tc := range []struct{ name, json, want string }{
16 {"new profile", "", mobilelink.OfficialRelay},
17 {"existing profile", `{"keyboard":"mac"}`, mobilelink.OfficialRelay},
18 {"custom relay", `{"mobile_relay":"https://relay.example:8443"}`, "https://relay.example:8443"},
19 {"damaged preferences", "{", ""},
20 {"insecure relay", `{"mobile_relay":"http://relay.example"}`, ""},
21 } {
22 t.Run(tc.name, func(t *testing.T) {
23 if tc.json != "" {
24 if err := os.WriteFile(prefs, []byte(tc.json), 0600); err != nil {
25 t.Fatal(err)
26 }
27 }
28 origin, err := profileRelay(config)
29 if origin != tc.want || (err != nil) != (tc.want == "") {
30 t.Fatalf("origin = %q, error = %v", origin, err)
31 }
32 })
33 }
34}