@@ -13,31 +13,38 @@ describe('extractInputFields', () => {
1313 } ,
1414 required : [ 'url' ] ,
1515 } ;
16- expect ( extractInputFields ( input ) ) . toEqual ( [
16+ const result = extractInputFields ( input ) ;
17+ expect ( result . fields ) . toEqual ( [
1718 { name : 'url' , type : 'string' , required : true } ,
1819 { name : 'maxResults' , type : 'number' , required : false } ,
1920 ] ) ;
21+ expect ( result . totalCount ) . toBe ( 2 ) ;
2022 } ) ;
2123
2224 it ( 'returns empty array for empty properties' , ( ) => {
2325 const input : ActorInputSchema = { type : 'object' , properties : { } } ;
24- expect ( extractInputFields ( input ) ) . toEqual ( [ ] ) ;
26+ const result = extractInputFields ( input ) ;
27+ expect ( result . fields ) . toEqual ( [ ] ) ;
28+ expect ( result . totalCount ) . toBe ( 0 ) ;
2529 } ) ;
2630
2731 it ( 'treats all fields as optional when required is missing' , ( ) => {
2832 const input : ActorInputSchema = {
2933 type : 'object' ,
3034 properties : { query : { title : 'Query' , description : 'Search query' , type : 'string' } } ,
3135 } ;
32- expect ( extractInputFields ( input ) ) . toEqual ( [ { name : 'query' , type : 'string' , required : false } ] ) ;
36+ const result = extractInputFields ( input ) ;
37+ expect ( result . fields ) . toEqual ( [ { name : 'query' , type : 'string' , required : false } ] ) ;
38+ expect ( result . totalCount ) . toBe ( 1 ) ;
3339 } ) ;
3440
3541 it ( 'falls back to unknown when type is missing' , ( ) => {
3642 const input : ActorInputSchema = {
3743 type : 'object' ,
3844 properties : { data : { title : 'Data' , description : 'Input data' } as never } ,
3945 } ;
40- expect ( extractInputFields ( input ) ) . toEqual ( [ { name : 'data' , type : 'unknown' , required : false } ] ) ;
46+ const result = extractInputFields ( input ) ;
47+ expect ( result . fields ) . toEqual ( [ { name : 'data' , type : 'unknown' , required : false } ] ) ;
4148 } ) ;
4249
4350 it ( 'returns only fields before the first sectionCaption' , ( ) => {
@@ -52,11 +59,12 @@ describe('extractInputFields', () => {
5259 } ,
5360 } as unknown as ActorInputSchema ;
5461
55- const fields = extractInputFields ( input ) ;
56- expect ( fields ) . toEqual ( [
62+ const result = extractInputFields ( input ) ;
63+ expect ( result . fields ) . toEqual ( [
5764 { name : 'query' , type : 'string' , required : false } ,
5865 { name : 'limit' , type : 'number' , required : false } ,
5966 ] ) ;
67+ expect ( result . totalCount ) . toBe ( 4 ) ;
6068 } ) ;
6169
6270 it ( 'caps at fallback limit when no sectionCaption exists' , ( ) => {
@@ -66,7 +74,8 @@ describe('extractInputFields', () => {
6674 }
6775 const input = { type : 'object' , properties : props } as unknown as ActorInputSchema ;
6876
69- const fields = extractInputFields ( input ) ;
70- expect ( fields ) . toHaveLength ( 10 ) ; // INPUT_FIELDS_FALLBACK_LIMIT
77+ const result = extractInputFields ( input ) ;
78+ expect ( result . fields ) . toHaveLength ( 10 ) ; // INPUT_FIELDS_FALLBACK_LIMIT
79+ expect ( result . totalCount ) . toBe ( 20 ) ;
7180 } ) ;
7281} ) ;
0 commit comments