返回 DeepSeek-Reasonix
goal_diagnostics_export_test.go
根目录 / desktop / goal_diagnostics_export_test.go
1 package main
2
3 import (
4 "context"
5 "io"
6 "net/http"
7 "strings"
8 "testing"
9 )
10
11 func TestExportRemoteGoalDiagnosticsUsesSessionFence(t *testing.T) {
12 var expectedPath string
13 client := &http.Client{Transport: roundTripFunc(func(req *http.Request) (*http.Response, error) {
14 expectedPath = req.Header.Get(expectedSessionPathHeader)
15 return &http.Response{StatusCode: http.StatusOK, Header: make(http.Header), Body: io.NopCloser(strings.NewReader(`{"schemaVersion":1}`)), Request: req}, nil
16 })}
17 app, tab := remoteRuntimeTestApp(client)
18 app.ctx = context.Background()
19 tab.capabilities[serveCapabilityGoalLifecycleV2] = true
20 payload, err := app.exportRemoteGoalDiagnostics(tab.id)
21 if err != nil {
22 t.Fatal(err)
23 }
24 if string(payload) != `{"schemaVersion":1}` || expectedPath != runtimeRemoteTestPath {
25 t.Fatalf("payload/path = %s / %q", payload, expectedPath)
26 }
27 }
28
28 lines GO