import { MockRouter , mockRequestHandler , mockDependencies } from '../../__mocks__' ; import { registerOverviewRoute } from './overview' ; describe ( 'Overview route' , ( ) => { describe ( 'GET /internal/workplace_search/overview' , ( ) => { let mockRouter ; beforeEach ( ( ) => { jest . clearAllMocks ( ) ; mockRouter = new MockRouter ( { method : 'get' , path : '/internal/workplace_search/overview' , } ) ; registerOverviewRoute ( { ... mockDependencies , router : mockRouter . router , } ) ; } ) ; it ( 'creates a request handler' , ( ) => { expect ( mockRequestHandler . createRequest ) . toHaveBeenCalledWith ( { path : '/ws/org' , hasValidData : expect . any ( Function ) , } ) ; } ) ; describe ( 'hasValidData' , ( ) => { it ( 'should correctly validate that the response has data' , ( ) => { const response = { accountsCount : 1 , } ; expect ( mockRequestHandler . hasValidData ( response ) ) . toBe ( true ) ; } ) ; it ( 'should correctly validate that a response does not have data' , ( ) => { const response = { foo : 'bar' , } ; expect ( mockRequestHandler . hasValidData ( response ) ) . toBe ( false ) ; } ) ; } ) ; } ) ; } ) ;