@@ -75,7 +75,7 @@ describe(`pseudo tests`, () => {
7575 expect ( employees . deps . find ( f => f . systemName === `EMPLOYEE` && f . type === `FILE` ) ) . toBeDefined ( ) ;
7676 } ) ;
7777
78- test ( 'makefile' , async ( ) => {
78+ test ( 'makefile' , async ( ) => {
7979 const makefile = new MakeProject ( targets . getCwd ( ) , targets , fs ) ;
8080 await makefile . setupSettings ( ) ;
8181
@@ -96,6 +96,113 @@ describe(`pseudo tests`, () => {
9696 expect ( steps . length ) . toBe ( 8 ) ;
9797 } ) ;
9898
99+ test ( 'makefile partial (without parents, object has no children)' , async ( ) => {
100+ const makefile = new MakeProject ( targets . getCwd ( ) , targets , fs ) ;
101+ makefile . setPartialOptions ( { parents : false } ) ;
102+ await makefile . setupSettings ( ) ;
103+
104+ const resolvedObjects = targets . getResolvedObjects ( ) ;
105+
106+ const nept = resolvedObjects . find ( f => f . systemName === `NEMP` && f . type === `FILE` ) ;
107+ const targetsOut = makefile . generateTargets ( [ nept ] ) . join ( `\n` ) ;
108+ console . log ( targetsOut ) ;
109+
110+ expect ( targetsOut ) . toContain ( `all: .logs .evfevent library $(PREPATH)/NEMP.FILE` ) ;
111+ expect ( targetsOut ) . not . toContain ( `$(PREPATH)/NEWEMP.PGM:` ) ;
112+
113+ const rules = makefile . generateGenericRules ( [ nept ] ) . join ( `\n` ) ;
114+ console . log ( rules ) ;
115+
116+ expect ( rules ) . toContain ( `$(PREPATH)/NEMP.FILE:` ) ;
117+ } ) ;
118+
119+ test ( 'makefile partial (without parents, object with children)' , async ( ) => {
120+ const makefile = new MakeProject ( targets . getCwd ( ) , targets , fs ) ;
121+ makefile . setPartialOptions ( { parents : false , withChildren : true } ) ;
122+ await makefile . setupSettings ( ) ;
123+
124+ const resolvedObjects = targets . getResolvedObjects ( ) ;
125+
126+ const nept = resolvedObjects . find ( f => f . systemName === `NEWEMP` && f . type === `PGM` ) ;
127+ const targetsOut = makefile . generateTargets ( [ nept ] ) . join ( `\n` ) ;
128+ console . log ( targetsOut ) ;
129+
130+ expect ( targetsOut ) . toContain ( `all: .logs .evfevent library $(PREPATH)/NEWEMP.PGM` ) ;
131+ expect ( targetsOut ) . toContain ( `$(PREPATH)/NEWEMP.PGM:` ) ;
132+
133+ const rules = makefile . generateGenericRules ( [ nept ] ) . join ( `\n` ) ;
134+ console . log ( rules ) ;
135+
136+ expect ( rules ) . toContain ( `$(PREPATH)/NEMP.FILE:` ) ;
137+ } ) ;
138+
139+ test ( 'makefile partial (without parents, object with children, but using withChildren false)' , async ( ) => {
140+ const makefile = new MakeProject ( targets . getCwd ( ) , targets , fs ) ;
141+ makefile . setPartialOptions ( { parents : false , withChildren : false } ) ;
142+ await makefile . setupSettings ( ) ;
143+
144+ const resolvedObjects = targets . getResolvedObjects ( ) ;
145+
146+ const nept = resolvedObjects . find ( f => f . systemName === `NEWEMP` && f . type === `PGM` ) ;
147+ const targetsOut = makefile . generateTargets ( [ nept ] ) . join ( `\n` ) ;
148+ console . log ( targetsOut ) ;
149+
150+ expect ( targetsOut ) . toContain ( `all: .logs .evfevent library $(PREPATH)/NEWEMP.PGM` ) ;
151+ expect ( targetsOut ) . not . toContain ( `$(PREPATH)/NEWEMP.PGM:` ) ;
152+
153+ const rules = makefile . generateGenericRules ( [ nept ] ) . join ( `\n` ) ;
154+ console . log ( rules ) ;
155+
156+ expect ( rules ) . not . toContain ( `$(PREPATH)/NEMP.FILE:` ) ;
157+ expect ( rules ) . toContain ( `$(PREPATH)/NEWEMP.PGM: qrpglesrc/newemp.pgm.sqlrpgle` ) ;
158+ } ) ;
159+
160+ test ( 'makefile partial (with parents)' , async ( ) => {
161+ const makefile = new MakeProject ( targets . getCwd ( ) , targets , fs ) ;
162+ makefile . setPartialOptions ( { parents : true } ) ;
163+ await makefile . setupSettings ( ) ;
164+
165+ const resolvedObjects = targets . getResolvedObjects ( ) ;
166+
167+ const nept = resolvedObjects . find ( f => f . systemName === `NEMP` && f . type === `FILE` ) ;
168+ const targetsOut = makefile . generateTargets ( [ nept ] ) . join ( `\n` ) ;
169+ console . log ( targetsOut ) ;
170+
171+ expect ( targetsOut ) . toContain ( `all: .logs .evfevent library $(PREPATH)/NEMP.FILE $(PREPATH)/NEWEMP.PGM $(PREPATH)/DEPTS.PGM` ) ;
172+ expect ( targetsOut ) . not . toContain ( `$(PREPATH)/NEWEMP.PGM:` ) ;
173+
174+ const rules = makefile . generateGenericRules ( [ nept ] ) . join ( `\n` ) ;
175+ console . log ( rules ) ;
176+
177+ expect ( rules ) . toContain ( `$(PREPATH)/NEMP.FILE:` ) ;
178+ expect ( rules ) . toContain ( `$(PREPATH)/NEWEMP.PGM:` ) ;
179+ expect ( rules ) . toContain ( `$(PREPATH)/DEPTS.PGM:` ) ;
180+ expect ( rules ) . not . toContain ( `$(PREPATH)/EMPLOYEES.PGM:` ) ;
181+ } ) ;
182+
183+ test ( 'makefile partial (with parents, and children parent)' , async ( ) => {
184+ const makefile = new MakeProject ( targets . getCwd ( ) , targets , fs ) ;
185+ makefile . setPartialOptions ( { parents : true , parentsChildren : true } ) ;
186+ await makefile . setupSettings ( ) ;
187+
188+ const resolvedObjects = targets . getResolvedObjects ( ) ;
189+
190+ const nept = resolvedObjects . find ( f => f . systemName === `NEMP` && f . type === `FILE` ) ;
191+ const targetsOut = makefile . generateTargets ( [ nept ] ) . join ( `\n` ) ;
192+ console . log ( targetsOut ) ;
193+
194+ expect ( targetsOut ) . toContain ( `all: .logs .evfevent library $(PREPATH)/NEMP.FILE $(PREPATH)/NEWEMP.PGM $(PREPATH)/DEPTS.PGM` ) ;
195+ expect ( targetsOut ) . toContain ( `$(PREPATH)/NEWEMP.PGM: $(PREPATH)/EMPLOYEE.FILE $(PREPATH)/NEMP.FILE` ) ;
196+
197+ const rules = makefile . generateGenericRules ( [ nept ] ) . join ( `\n` ) ;
198+ console . log ( rules ) ;
199+
200+ expect ( rules ) . toContain ( `$(PREPATH)/NEMP.FILE:` ) ;
201+ expect ( rules ) . toContain ( `$(PREPATH)/NEWEMP.PGM:` ) ;
202+ expect ( rules ) . toContain ( `$(PREPATH)/DEPTS.PGM:` ) ;
203+ expect ( rules ) . toContain ( `$(PREPATH)/EMPLOYEES.PGM:` ) ;
204+ } ) ;
205+
99206 test ( 'ibmi-bob rules' , ( ) => {
100207 const bobProject = new BobProject ( targets ) ;
101208
0 commit comments