@@ -270,104 +270,60 @@ describe('lb4 controller', () => {
270270
271271 /**
272272 * Assertions against the template to determine if it contains the
273- * required signatures for a CRUD controller.
274- * @param {String } tmpDir The temporary directory path to check. Uses
275- * withInputName to determine the file name.
273+ * required signatures for a REST CRUD controller, specifically to ensure
274+ * that decorators are grouped correctly (for their corresponding
275+ * target functions)
276+ *
277+ * This function calls checkCrudContents.
278+ * @param {String } tmpDir
276279 */
277- function checkCrudContents ( tmpDir ) {
280+ function checkRestCrudContents ( tmpDir ) {
278281 assert . fileContent ( tmpDir + withInputName , / c l a s s F o o B a r C o n t r o l l e r / ) ;
279282
280283 // Repository and injection
281284 assert . fileContent (
282285 tmpDir + withInputName ,
283- / \@ i n j e c t \( ' r e p o s i t o r i e s .f o o ' \) /
286+ / \@ i n j e c t \( ' r e p o s i t o r i e s .B a r R e p o s i t o r y ' \) /
284287 ) ;
285288 assert . fileContent (
286289 tmpDir + withInputName ,
287290 / b a r R e p o s i t o r y \: B a r R e p o s i t o r y /
288291 ) ;
289- // Check function signatures
290- assert . fileContent (
291- tmpDir + withInputName ,
292- / a s y n c c r e a t e \( o b j \: F o o \) \: P r o m i s e \< F o o \> /
293- ) ;
294- assert . fileContent (
295- tmpDir + withInputName ,
296- / a s y n c c o u n t \( w h e r e \: W h e r e \) \: P r o m i s e \< n u m b e r \> /
297- ) ;
298- assert . fileContent (
299- tmpDir + withInputName ,
300- / a s y n c f i n d \( f i l t e r \: F i l t e r \) \: P r o m i s e \< F o o \[ \] \> /
301- ) ;
302- assert . fileContent (
303- tmpDir + withInputName ,
304- / a s y n c u p d a t e A l l \( w h e r e \: W h e r e , o b j \: F o o \) \: P r o m i s e \< n u m b e r \> /
305- ) ;
306- assert . fileContent (
307- tmpDir + withInputName ,
308- / a s y n c d e l e t e A l l \( w h e r e \: W h e r e \) \: P r o m i s e \< n u m b e r \> /
309- ) ;
310- assert . fileContent (
311- tmpDir + withInputName ,
312- / a s y n c f i n d B y I d \( i d \: n u m b e r \) \: P r o m i s e \< F o o \> /
313- ) ;
314- assert . fileContent (
315- tmpDir + withInputName ,
316- / a s y n c u p d a t e B y I d \( i d \: n u m b e r , o b j \: F o o \) \: P r o m i s e \< b o o l e a n \> /
317- ) ;
318- assert . fileContent (
319- tmpDir + withInputName ,
320- / a s y n c d e l e t e B y I d \( i d \: n u m b e r \) \: P r o m i s e \< b o o l e a n \> / ,
321- ''
322- ) ;
323- }
324-
325- /**
326- * Assertions against the template to determine if it contains the
327- * required signatures for a REST CRUD controller, specifically to ensure
328- * that decorators are grouped correctly (for their corresponding
329- * target functions)
330- *
331- * This function calls checkCrudContents.
332- * @param {String } tmpDir
333- */
334- function checkRestCrudContents ( tmpDir ) {
335- checkCrudContents ( tmpDir ) ;
336292
337293 // Assert that the decorators are present in the correct groupings!
338294 assert . fileContent (
339295 tmpDir + withInputName ,
340- / \@ p o s t \( ' \/ f o o ' \) \s { 1 , } \ @p a r a m .b o d y \( ' o b j ' , F o o \) \s { 1 , } a s y n c c r e a t e /
296+ / \@ p o s t \( ' \/ f o o ' \) \s { 1 , } a s y n c c r e a t e \( \ @p a r a m .b o d y \( ' o b j ' \) /
341297 ) ;
342298
343299 assert . fileContent (
344300 tmpDir + withInputName ,
345- / \@ g e t \( ' \/ f o o \/ c o u n t ' \) \s { 1 , } \ @p a r a m .q u e r y .s t r i n g \( ' w h e r e ' \) \s { 1 , } a s y n c c o u n t /
301+ / \@ g e t \( ' \/ f o o \/ c o u n t ' \) \s { 1 , } a s y n c c o u n t \( \ @p a r a m .q u e r y .s t r i n g \( ' w h e r e ' \) /
346302 ) ;
347303
348304 assert . fileContent (
349305 tmpDir + withInputName ,
350- / \@ g e t \( ' \/ f o o ' \) \s { 1 , } \ @p a r a m .q u e r y .s t r i n g \( ' f i l t e r ' \) \s { 1 , } a s y n c f i n d /
306+ / \@ g e t \( ' \/ f o o ' \) \s { 1 , } a s y n c f i n d \( \ @p a r a m .q u e r y .s t r i n g \( ' f i l t e r ' \) /
351307 ) ;
352308 assert . fileContent (
353309 tmpDir + withInputName ,
354- / \@ p a t c h \( ' \/ f o o ' \) \s { 1 , } \ @p a r a m .q u e r y .s t r i n g \( ' w h e r e ' \) \s { 1 , } \@ p a r a m .b o d y \( ' o b j ' , F o o \) \s { 1 , } a s y n c u p d a t e A l l /
310+ / \@ p a t c h \( ' \/ f o o ' \) \s { 1 , } a s y n c u p d a t e A l l \( \ @p a r a m .q u e r y .s t r i n g \( ' w h e r e ' \) w h e r e : W h e r e , \s { 1 , } \@ p a r a m .b o d y \( ' o b j ' \) /
355311 ) ;
356312 assert . fileContent (
357313 tmpDir + withInputName ,
358- / \@ d e l \( ' \/ f o o ' \) \s { 1 , } \ @p a r a m .q u e r y .s t r i n g \( ' w h e r e ' \) \s { 1 , } a s y n c d e l e t e A l l /
314+ / \@ d e l \( ' \/ f o o ' \) \s { 1 , } a s y n c d e l e t e A l l \( \ @p a r a m .q u e r y .s t r i n g \( ' w h e r e ' \) /
359315 ) ;
360316 assert . fileContent (
361317 tmpDir + withInputName ,
362- / \@ g e t \( ' \/ f o o \/ { id} ' \) \s { 1 , } a s y n c f i n d B y I d /
318+ / \@ g e t \( ' \/ f o o \/ { id} ' \) \s { 1 , } a s y n c f i n d B y I d \( \@ p a r a m . p a t h . n u m b e r \( ' i d ' \) /
363319 ) ;
364320 assert . fileContent (
365321 tmpDir + withInputName ,
366- / \@ p a t c h \( ' \/ f o o \/ { id} ' \) \s { 1 , } \ @p a r a m .b o d y \( ' o b j ' , F o o \) \s { 1 , } a s y n c u p d a t e B y I d /
322+ / \@ p a t c h \( ' \/ f o o \/ { id} ' \) \s { 1 , } a s y n c u p d a t e B y I d \( \ @p a r a m .p a t h . n u m b e r \( ' i d ' \) i d : n u m b e r , \@ p a r a m . b o d y \( ' o b j ' \) /
367323 ) ;
368324 assert . fileContent (
369325 tmpDir + withInputName ,
370- / \@ d e l \( ' \/ f o o \/ { id} ' \) \s { 1 , } a s y n c d e l e t e B y I d /
326+ / \@ d e l \( ' \/ f o o \/ { id} ' \) \s { 1 , } a s y n c d e l e t e B y I d \( \@ p a r a m . p a t h . n u m b e r \( ' i d ' \) i d : n u m b e r \) /
371327 ) ;
372328 }
373329} ) ;
0 commit comments