@@ -248,7 +248,7 @@ describe.skipIf(files.length === 0)(`company_system tests`, () => {
248248 ] . join ( ) ) ;
249249 } ) ;
250250
251- test ( `Checking makefile rule generation` , async ( ) => {
251+ test ( `Checking makefile rule generation` , ( ) => {
252252 const project = new MakeProject ( cwd , targets ) ;
253253
254254 const headerContent = project . generateGenericRules ( ) ;
@@ -259,6 +259,52 @@ describe.skipIf(files.length === 0)(`company_system tests`, () => {
259259 expect ( headerContent . find ( l => l === `$(PREPATH)/DEPARTMENT.FILE: qddssrc/department.table` ) ) . toBeDefined ( ) ;
260260 } ) ;
261261
262+ test ( `Makefile targets for all` , ( ) => {
263+ const project = new MakeProject ( cwd , targets ) ;
264+
265+ // Generate targets on it's own will have BNDDIR, PGM, etc
266+ const headerContent = project . generateTargets ( ) ;
267+
268+ const allTarget = headerContent . find ( l => l . startsWith ( `all:` ) ) ;
269+ expect ( allTarget ) . toBeDefined ( ) ;
270+
271+ expect ( allTarget ) . toContain ( `all: .logs .evfevent library` ) ;
272+ // The order cannot be guaranteed, so we just check for the presence of the targets
273+ expect ( allTarget ) . toContain ( `$(PREPATH)/$(APP_BNDDIR).BNDDIR` ) ;
274+ expect ( allTarget ) . toContain ( `$(PREPATH)/MYPGM.PGM` ) ;
275+ expect ( allTarget ) . toContain ( `$(PREPATH)/DEPTS.PGM` ) ;
276+ expect ( allTarget ) . toContain ( `$(PREPATH)/EMPLOYEES.PGM` ) ;
277+ } ) ;
278+
279+ test ( `Makefile targets for specific object (DEPTS display file)` , ( ) => {
280+ const project = new MakeProject ( cwd , targets ) ;
281+
282+ const deptsFile = targets . getDep ( { name : `DEPTS` , type : `FILE` } ) ;
283+
284+ // Generate targets on it's own will have BNDDIR, PGM, etc
285+ const headerContent = project . generateTargets ( [ deptsFile ] ) ;
286+
287+ const allTarget = headerContent . find ( l => l . startsWith ( `all:` ) ) ;
288+ expect ( allTarget ) . toBeDefined ( ) ;
289+
290+ expect ( allTarget ) . toBe ( `all: .logs .evfevent library $(PREPATH)/DEPTS.FILE $(PREPATH)/DEPTS.PGM` ) ;
291+ } ) ;
292+
293+ test ( `Makefile targets for specific object (EMPLOYEE table)` , ( ) => {
294+ const project = new MakeProject ( cwd , targets ) ;
295+
296+ const deptsFile = targets . getDep ( { name : `EMPLOYEE` , type : `FILE` } ) ;
297+
298+ // Generate targets on it's own will have BNDDIR, PGM, etc
299+ const headerContent = project . generateTargets ( [ deptsFile ] ) ;
300+
301+ const allTarget = headerContent . find ( l => l . startsWith ( `all:` ) ) ;
302+ expect ( allTarget ) . toBeDefined ( ) ;
303+
304+ expect ( allTarget ) . toBe ( `all: .logs .evfevent library $(PREPATH)/EMPLOYEE.FILE $(PREPATH)/EMPLOYEES.PGM $(PREPATH)/DEPTS.PGM` ) ;
305+ } ) ;
306+
307+
262308 test ( `Impact of EMPLOYEES` , ( ) => {
263309 const empPgm = targets . getDep ( { name : `EMPLOYEES` , type : `PGM` } ) ;
264310 expect ( empPgm . relativePath ) . toBe ( path . join ( `qrpglesrc` , `employees.pgm.sqlrpgle` ) ) ;
0 commit comments