@@ -382,6 +382,56 @@ func TestJSONRPC_StreamingKeepAlive(t *testing.T) {
382382 }
383383}
384384
385+ func TestJSONRPC_DeletePushConfigResponse (t * testing.T ) {
386+ t .Parallel ()
387+ ctx := t .Context ()
388+
389+ taskID := a2a .NewTaskID ()
390+ config := & a2a.PushConfig {ID : "config-1" , URL : "https://example.com/push" }
391+ store := testutil .NewTestTaskStore ().WithTasks (t , & a2a.Task {ID : taskID })
392+ pushStore := testutil .NewTestPushConfigStore ().WithConfigs (t , taskID , config )
393+ pushSender := testutil .NewTestPushSender (t ).SetSendPushError (nil )
394+ reqHandler := NewHandler (
395+ & mockAgentExecutor {},
396+ WithTaskStore (store ),
397+ WithPushNotifications (pushStore , pushSender ),
398+ )
399+ server := httptest .NewServer (NewJSONRPCHandler (reqHandler ))
400+ defer server .Close ()
401+
402+ params := mustMarshal (t , & a2a.DeleteTaskPushConfigRequest {TaskID : taskID , ID : config .ID })
403+ request := jsonrpc.ServerRequest {
404+ JSONRPC : "2.0" ,
405+ Method : jsonrpc .MethodPushConfigDelete ,
406+ Params : params ,
407+ ID : "delete-1" ,
408+ }
409+ req , err := http .NewRequestWithContext (ctx , "POST" , server .URL , bytes .NewBuffer (mustMarshal (t , request )))
410+ if err != nil {
411+ t .Fatalf ("http.NewRequestWithContext() error = %v" , err )
412+ }
413+
414+ resp , err := http .DefaultClient .Do (req )
415+ if err != nil {
416+ t .Fatalf ("http.DefaultClient.Do() error = %v" , err )
417+ }
418+ defer func () { _ = resp .Body .Close () }()
419+
420+ var payload jsonrpc.ServerResponse
421+ if err := json .NewDecoder (resp .Body ).Decode (& payload ); err != nil {
422+ t .Fatalf ("json.Decode() error = %v, want valid JSON-RPC response" , err )
423+ }
424+ if payload .JSONRPC != "2.0" {
425+ t .Fatalf ("payload.JSONRPC = %q, want %q" , payload .JSONRPC , "2.0" )
426+ }
427+ if payload .Error != nil {
428+ t .Fatalf ("payload.Error = %v, want nil" , payload .Error )
429+ }
430+ if payload .ID != "delete-1" {
431+ t .Fatalf ("payload.ID = %v, want %q" , payload .ID , "delete-1" )
432+ }
433+ }
434+
385435func mustMarshal (t * testing.T , data any ) []byte {
386436 t .Helper ()
387437 body , err := json .Marshal (data )
0 commit comments