@@ -11,12 +11,20 @@ const gatewayCalls: Array<{
1111 mode ?: string ;
1212 hasDeviceIdentityKey : boolean ;
1313} > = [ ] ;
14+
15+ function gatewayParams ( params : unknown ) : Record < string , unknown > {
16+ if ( typeof params !== "object" || params === null || Array . isArray ( params ) ) {
17+ throw new TypeError ( "Expected gateway params to be an object" ) ;
18+ }
19+ return params as Record < string , unknown > ;
20+ }
21+
1422vi . mock ( "../gateway/call.js" , ( ) => ( {
1523 callGateway : vi . fn (
1624 async ( p : { method : string ; params : Record < string , unknown > ; mode ?: string } ) => {
1725 gatewayCalls . push ( {
1826 method : p . method ,
19- params : p . params ,
27+ params : gatewayParams ( p . params ) ,
2028 mode : p . mode ,
2129 hasDeviceIdentityKey : "deviceIdentity" in p ,
2230 } ) ;
@@ -156,7 +164,7 @@ describe("openclaw attach (action)", () => {
156164 vi . mocked ( callGateway ) . mockImplementationOnce ( async ( p ) => {
157165 gatewayCalls . push ( {
158166 method : p . method ,
159- params : p . params ,
167+ params : gatewayParams ( p . params ) ,
160168 mode : p . mode ,
161169 hasDeviceIdentityKey : "deviceIdentity" in p ,
162170 } ) ;
@@ -171,7 +179,7 @@ describe("openclaw attach (action)", () => {
171179 vi . mocked ( callGateway ) . mockImplementationOnce ( async ( p ) => {
172180 gatewayCalls . push ( {
173181 method : p . method ,
174- params : p . params ,
182+ params : gatewayParams ( p . params ) ,
175183 mode : p . mode ,
176184 hasDeviceIdentityKey : "deviceIdentity" in p ,
177185 } ) ;
0 commit comments