返回 DeepSeek-Reasonix
shared_host_registration_test.go
根目录 / desktop / shared_host_registration_test.go
1 package main
2
3 import (
4 "context"
5 "testing"
6
7 "reasonix/internal/plugin"
8 )
9
10 func TestSharedHostMCPRegistrationLifecycle(t *testing.T) {
11 host := plugin.NewHost()
12 defer host.Close()
13
14 _, abandoned := beginSharedHostMCPRegistration(context.Background(), host)
15 abandoned.rollback()
16 if abandoned.commit() {
17 t.Fatal("aborted registration must not publish")
18 }
19
20 _, published := beginSharedHostMCPRegistration(context.Background(), host)
21 if !published.commit() {
22 t.Fatal("active registration should publish")
23 }
24 published.rollback()
25 if !published.commit() {
26 t.Fatal("committed registration must remain published")
27 }
28
29 _, hostless := beginSharedHostMCPRegistration(context.Background(), nil)
30 if !hostless.commit() {
31 t.Fatal("hostless registration should publish as a no-op")
32 }
33 }
34
34 lines GO