@@ -1025,34 +1025,38 @@ describe("Documentation", () => {
10251025 expect ( spec ) . toMatchSnapshot ( ) ;
10261026 } ) ;
10271027
1028- test ( "should pass over the example of an individual parameter" , ( ) => {
1029- const spec = new Documentation ( {
1030- config : sampleConfig ,
1031- routing : {
1032- v1 : {
1033- getSomething : defaultEndpointsFactory . build ( {
1034- input : z . object ( {
1035- strNum : z
1036- . string ( )
1037- . example ( "123" ) // example for the input side of the transformation
1038- . transform ( ( v ) => parseInt ( v , 10 ) ) ,
1039- } ) ,
1040- output : z . object ( {
1041- numericStr : z
1042- . number ( )
1043- . transform ( ( v ) => `${ v } ` )
1044- . example ( "456" ) , // example for the output side of the transformation
1028+ test . each < Method > ( [ "get" , "post" ] ) (
1029+ "should pass over the example of an individual prop in %s request" ,
1030+ ( method ) => {
1031+ const spec = new Documentation ( {
1032+ config : sampleConfig ,
1033+ routing : {
1034+ v1 : {
1035+ getSomething : defaultEndpointsFactory . build ( {
1036+ method,
1037+ input : z . object ( {
1038+ strNum : z
1039+ . string ( )
1040+ . example ( "123" ) // example for the input side of the transformation
1041+ . transform ( ( v ) => parseInt ( v , 10 ) ) ,
1042+ } ) ,
1043+ output : z . object ( {
1044+ numericStr : z
1045+ . number ( )
1046+ . transform ( ( v ) => `${ v } ` )
1047+ . example ( "456" ) , // example for the output side of the transformation
1048+ } ) ,
1049+ handler : async ( ) => ( { numericStr : 123 } ) ,
10451050 } ) ,
1046- handler : async ( ) => ( { numericStr : 123 } ) ,
1047- } ) ,
1051+ } ,
10481052 } ,
1049- } ,
1050- version : "3.4.5 " ,
1051- title : "Testing Metadata: example on IO parameter " ,
1052- serverUrl : "https://example.com" ,
1053- } ) . getSpecAsYaml ( ) ;
1054- expect ( spec ) . toMatchSnapshot ( ) ;
1055- } ) ;
1053+ version : "3.4.5" ,
1054+ title : "Testing Metadata:example on IO parameter " ,
1055+ serverUrl : "https:// example.com " ,
1056+ } ) . getSpecAsYaml ( ) ;
1057+ expect ( spec ) . toMatchSnapshot ( ) ;
1058+ } ,
1059+ ) ;
10561060
10571061 test . each < Method > ( [ "get" , "post" ] ) (
10581062 "should pass over examples of each param from the whole IO schema examples (%s method)" ,
0 commit comments