| 2157 | } |
| 2158 | |
| 2159 | func TestResumeSessionRequest_ContinuePendingWork(t *testing.T) { |
| 2160 | t.Run("forwards continuePendingWork when true", func(t *testing.T) { |
| 2161 | req := resumeSessionRequest{ |
| 2162 | SessionID: "s1", |
| 2163 | ContinuePendingWork: Bool(true), |
| 2164 | } |
| 2165 | data, err := json.Marshal(req) |
| 2166 | if err != nil { |
| 2167 | t.Fatalf("Failed to marshal: %v", err) |
| 2168 | } |
| 2169 | var m map[string]any |
| 2170 | if err := json.Unmarshal(data, &m); err != nil { |
| 2171 | t.Fatalf("Failed to unmarshal: %v", err) |
| 2172 | } |
| 2173 | if m["continuePendingWork"] != true { |
| 2174 | t.Errorf("Expected continuePendingWork to be true, got %v", m["continuePendingWork"]) |
| 2175 | } |
| 2176 | }) |
| 2177 | |
| 2178 | t.Run("forwards continuePendingWork when false", func(t *testing.T) { |
| 2179 | req := resumeSessionRequest{ |
| 2180 | SessionID: "s1", |
| 2181 | ContinuePendingWork: Bool(false), |
| 2182 | } |
| 2183 | data, err := json.Marshal(req) |
| 2184 | if err != nil { |
| 2185 | t.Fatalf("Failed to marshal: %v", err) |
| 2186 | } |
| 2187 | var m map[string]any |
| 2188 | if err := json.Unmarshal(data, &m); err != nil { |
| 2189 | t.Fatalf("Failed to unmarshal: %v", err) |
| 2190 | } |
| 2191 | if m["continuePendingWork"] != false { |
| 2192 | t.Errorf("Expected continuePendingWork to be false, got %v", m["continuePendingWork"]) |
| 2193 | } |
| 2194 | }) |
| 2195 | |
| 2196 | t.Run("omits continuePendingWork when not set", func(t *testing.T) { |
| 2197 | req := resumeSessionRequest{SessionID: "s1"} |
| 2198 | data, _ := json.Marshal(req) |
| 2199 | var m map[string]any |
| 2200 | json.Unmarshal(data, &m) |
| 2201 | if _, ok := m["continuePendingWork"]; ok { |
| 2202 | t.Error("Expected continuePendingWork to be omitted when not set") |
| 2203 | } |
| 2204 | }) |
| 2205 | } |
| 2206 | |
| 2207 | func TestCreateSessionRequest_EnableSessionTelemetry(t *testing.T) { |
| 2208 | t.Run("forwards enableSessionTelemetry when false", func(t *testing.T) { |