@@ -23,17 +23,27 @@ describe("All endpoints are valid", () => {
2323 for ( const node of endpoints ) {
2424 const endpoint = node . endpoint ;
2525
26- expect ( endpoint . method ) . toBeTypeof ( "string" ) ;
27- expect ( endpoint . method ) . toBeIncludedBy ( [ "GET" , "POST" , "DELETE" ] ) ;
28- expect ( endpoint . paths ) . toBeArray ( ) ;
29- expect ( endpoint . rateLimit ) . toBeTypeof ( "string" ) ;
30- expect ( endpoint . rateLimit ) . toBeIncludedBy ( [ "generic" , "auth" ] ) ;
31- expect ( endpoint . successStatus ) . toBeTypeof ( "number" ) ;
32- expect ( endpoint . options ) . toBeDefined ( ) ;
26+ if ( node . version === 2 ) {
27+ expect ( endpoint . method ) . toBeTypeof ( "string" ) ;
28+ expect ( endpoint . method ) . toBeIncludedBy ( [ "GET" , "POST" , "DELETE" ] ) ;
3329
34- if ( endpoint . endpointKind ) {
35- expect ( endpoint . endpointKind ) . toBeTypeof ( "string" ) ;
36- expect ( endpoint . endpointKind ) . toBeIncludedBy ( [ "raw" , "default" ] ) ;
30+ expect ( Array . isArray ( endpoint . path ) || typeof endpoint . path === "string" ) . toBe ( true ) ;
31+
32+ expect ( node . headers ) . toBeDefined ( ) ;
33+ } else {
34+ // Implicit V1
35+ expect ( endpoint . method ) . toBeTypeof ( "string" ) ;
36+ expect ( endpoint . method ) . toBeIncludedBy ( [ "GET" , "POST" , "DELETE" ] ) ;
37+ expect ( endpoint . paths ) . toBeArray ( ) ;
38+ expect ( endpoint . rateLimit ) . toBeTypeof ( "string" ) ;
39+ expect ( endpoint . rateLimit ) . toBeIncludedBy ( [ "generic" , "auth" ] ) ;
40+ expect ( endpoint . successStatus ) . toBeTypeof ( "number" ) ;
41+ expect ( endpoint . options ) . toBeDefined ( ) ;
42+
43+ if ( endpoint . endpointKind ) {
44+ expect ( endpoint . endpointKind ) . toBeTypeof ( "string" ) ;
45+ expect ( endpoint . endpointKind ) . toBeIncludedBy ( [ "raw" , "default" ] ) ;
46+ }
3747 }
3848 }
3949 } ) ;
0 commit comments