@@ -88,6 +88,29 @@ func TestListOutputsRejectsEmptyOutputTypeList(t *testing.T) {
8888 require .Equal (t , "Invalid output type: expected at least one selector" , response .Error .Message )
8989}
9090
91+ func TestListOutputsRejectsMalformedOutputType (t * testing.T ) {
92+ for name , selector := range map [string ]string {
93+ "wrong length" : "0x1234" ,
94+ "non hex" : "0xzzzzzzzz" ,
95+ } {
96+ t .Run (name , func (t * testing.T ) {
97+ s := newBatchTestService ()
98+ body := []byte (fmt .Sprintf (`{
99+ "jsonrpc":"2.0",
100+ "method":"cartesi_listOutputs",
101+ "params":{"application":"app","output_type":%q},
102+ "id":1
103+ }` , selector ))
104+ rr := serveRPC (t , s , body )
105+
106+ require .Equal (t , http .StatusOK , rr .Code )
107+ response := decodeRPCResponse (t , rr .Body .Bytes ())
108+ requireRPCError (t , response , float64 (1 ), JSONRPC_INVALID_PARAMS )
109+ require .Contains (t , response .Error .Message , "Invalid output type" )
110+ })
111+ }
112+ }
113+
91114func TestJSONRPCBatchRejectsEmptyBatchWithSingleObject (t * testing.T ) {
92115 s := newBatchTestService ()
93116 rr := serveRPC (t , s , []byte (`[]` ))
0 commit comments