@@ -141,11 +141,14 @@ async function boot() {
141141 ( rest as any ) . resolveExecCtx = async ( ) => caller ;
142142 rest . registerRoutes ( ) ;
143143 const routes = rest . getRoutes ( ) ;
144- const find = ( method : string , path : string ) => routes . find ( ( r : any ) => r . method === method && r . path === path ) ;
144+ const find = ( method : string , path : string ) : any => {
145+ const route = routes . find ( ( r : any ) => r . method === method && r . path === path ) ;
146+ if ( ! route ) throw new Error ( `route ${ method } ${ path } is not registered` ) ;
147+ return route ;
148+ } ;
145149 const sync = find ( 'POST' , '/api/v1/data/:object/import' ) ;
146150 const jobs = find ( 'POST' , '/api/v1/data/:object/import/jobs' ) ;
147151 const progress = find ( 'GET' , '/api/v1/data/import/jobs/:jobId' ) ;
148- expect ( sync && jobs && progress ) . toBeTruthy ( ) ;
149152 return {
150153 engine,
151154 as ( next : Record < string , unknown > ) { caller = next ; } ,
@@ -255,9 +258,9 @@ describe('[#24348] the import doors honour a control opt-out only for the system
255258 ctx . as ( SYSTEM ) ;
256259 const deal = await ctx . door ( kind , 'oo_deal' , { format : 'json' , rows : DEAL_ROWS , runAutomations : false } ) ;
257260 expect ( kind === 'sync' ? deal . res . _json : deal . job ) . toMatchObject ( { created : 1 } ) ;
258- const stored = await ctx . engine . findOne ( 'oo_deal' , { where : { id : 'd1' } } ) ;
261+ const stored : any = await ctx . engine . findOne ( 'oo_deal' , { where : { id : 'd1' } } ) ;
259262 expect ( stored ) . toMatchObject ( { name : 'Acme renewal' } ) ;
260- expect ( stored . approval_status ?? null ) . toBeNull ( ) ;
263+ expect ( stored ? .approval_status ?? null ) . toBeNull ( ) ;
261264
262265 const frozen = await ctx . door ( kind , 'oo_case' , { format : 'json' , rows : CASE_ROWS , ...CASE_UPDATE , runAutomations : false } ) ;
263266 expect ( kind === 'sync' ? frozen . res . _json : frozen . job ) . toMatchObject ( { updated : 1 } ) ;
0 commit comments