@@ -5,11 +5,6 @@ const happyPathBuilders = require( '../helpers/happyPathRequestBuilders' );
55const extensionRepoConfig = require ( '../../../../../../extension-repo.json' ) ;
66
77describe ( 'Route Coverage Tests' , ( ) => {
8- const EXCLUDED_ROUTES = [
9- 'GET /v1/openapi.json' ,
10- 'GET /v1/property-data-types'
11- ] ;
12-
138 const mockInputs = {
149 itemId : 'Q123' ,
1510 propertyId : 'P123' ,
@@ -29,6 +24,8 @@ describe( 'Route Coverage Tests', () => {
2924 method : route . method ,
3025 path : route . path . split ( '/wikibase' ) [ 1 ]
3126 } )
27+ ) . filter (
28+ ( route ) => route . path . startsWith ( '/v1/entities' ) || route . path . startsWith ( '/v1/statements' )
3229 ) ;
3330 }
3431
@@ -50,22 +47,20 @@ describe( 'Route Coverage Tests', () => {
5047 }
5148
5249 it ( 'should have all production routes covered in happy path builders' , ( ) => {
53- const productionRoutes = getAllProductionRoutes ( )
54- . map ( ( route ) => routeToString ( route ) )
55- . filter ( ( route ) => ! EXCLUDED_ROUTES . includes ( route ) ) ;
50+ const productionRoutes = getAllProductionRoutes ( ) . map ( routeToString ) ;
51+ const happyPathRoutes = getAllHappyPathRoutes ( ) . map ( routeToString ) ;
5652
57- const happyPathRoutes = getAllHappyPathRoutes ( )
58- . map ( ( route ) => routeToString ( route ) ) ;
53+ assert . ok ( productionRoutes . length > 0 , 'No production routes found.' ) ;
54+ assert . ok ( happyPathRoutes . length > 0 , 'No happy path routes found.' ) ;
5955
6056 const missingRoutes = productionRoutes . filter (
6157 ( route ) => ! happyPathRoutes . includes ( route )
6258 ) ;
6359
64- if ( missingRoutes . length > 0 ) {
65- assert . fail (
66- `Found ${ missingRoutes . length } production routes not covered in happy path builders:\n\n` +
67- missingRoutes . join ( '\n' )
68- ) ;
69- }
60+ assert . ok (
61+ ! missingRoutes . length > 0 ,
62+ `Found ${ missingRoutes . length } production routes not covered in happy path builders:\n\n` +
63+ missingRoutes . join ( '\n' )
64+ ) ;
7065 } ) ;
7166} ) ;
0 commit comments