import { MockRouter , mockRequestHandler , mockDependencies } from '../../__mocks__' ; import { registerOnboardingRoutes } from './onboarding' ; describe ( 'engine routes' , ( ) => { describe ( 'POST /internal/app_search/onboarding_complete' , ( ) => { let mockRouter ; beforeEach ( ( ) => { jest . clearAllMocks ( ) ; mockRouter = new MockRouter ( { method : 'post' , path : '/internal/app_search/onboarding_complete' , } ) ; registerOnboardingRoutes ( { ... mockDependencies , router : mockRouter . router , } ) ; } ) ; it ( 'creates a request handler' , ( ) => { mockRouter . callRoute ( { body : { } } ) ; expect ( mockRequestHandler . createRequest ) . toHaveBeenCalledWith ( { path : '/as/onboarding/complete' , hasJsonResponse : false , } ) ; } ) ; it ( 'validates seed_sample_engine ' , ( ) => { const request = { body : { seed_sample_engine : true } } ; mockRouter . shouldValidate ( request ) ; } ) ; } ) ; } ) ;