@@ -93,42 +93,21 @@ describe('tools/scapi/scapi-custom-apis-get-status', () => {
9393 } ) ;
9494
9595 describe ( 'createScapiCustomApisStatusTool' , ( ) => {
96- it ( 'should create scapi_custom_apis_get_status tool with correct metadata and input schema ' , ( ) => {
96+ it ( 'should create scapi_custom_apis_get_status tool with correct metadata' , ( ) => {
9797 const tool = createScapiCustomApisStatusTool ( ( ) => services ) ;
9898
99- expect ( tool ) . to . exist ;
10099 expect ( tool . name ) . to . equal ( 'scapi_custom_apis_get_status' ) ;
101100 expect ( tool . description ) . to . be . a ( 'string' ) . and . not . empty ;
101+ expect ( tool . inputSchema ) . to . exist ;
102102 expect ( tool . handler ) . to . be . a ( 'function' ) ;
103103 expect ( tool . toolsets ) . to . deep . equal ( [ 'PWAV3' , 'SCAPI' , 'STOREFRONTNEXT' ] ) ;
104104 expect ( tool . isGA ) . to . be . true ;
105-
106- // Input schema: status, groupBy, columns - all optional Zod schemas.
107- expect ( tool . inputSchema ) . to . exist ;
108- const schema = tool . inputSchema as Record <
109- string ,
110- { isOptional ?: ( ) => boolean ; safeParse ?: ( v : unknown ) => unknown }
111- > ;
112- expect ( Object . keys ( schema ) ) . to . have . members ( [ 'status' , 'groupBy' , 'columns' ] ) ;
113- // Each field should be optional and individually parseable as a Zod schema.
114- for ( const key of [ 'status' , 'groupBy' , 'columns' ] ) {
115- expect ( schema [ key ] ?. safeParse , `${ key } should expose a Zod safeParse` ) . to . be . a ( 'function' ) ;
116- expect ( schema [ key ] ?. isOptional ?.( ) , `${ key } should be optional` ) . to . equal ( true ) ;
117- }
118- // status restricts to enum values
119- const statusOk = ( schema . status . safeParse as ( v : unknown ) => { success : boolean } ) . bind ( schema . status ) ;
120- expect ( statusOk ( 'active' ) ) . to . have . property ( 'success' , true ) ;
121- expect ( statusOk ( 'not_registered' ) ) . to . have . property ( 'success' , true ) ;
122- expect ( statusOk ( 'bogus' ) ) . to . have . property ( 'success' , false ) ;
123105 } ) ;
124106
125107 it ( 'should have optional input params: status, groupBy, columns' , ( ) => {
126108 const tool = createScapiCustomApisStatusTool ( ( ) => services ) ;
127109
128- expect ( tool . inputSchema ) . to . have . property ( 'status' ) ;
129- expect ( tool . inputSchema ) . to . have . property ( 'groupBy' ) ;
130- expect ( tool . inputSchema ) . to . have . property ( 'columns' ) ;
131- expect ( tool . inputSchema ) . to . not . have . property ( 'extended' ) ;
110+ expect ( Object . keys ( tool . inputSchema as object ) ) . to . have . members ( [ 'status' , 'groupBy' , 'columns' ] ) ;
132111 } ) ;
133112 } ) ;
134113
0 commit comments