@@ -96,9 +96,70 @@ describe(`pseudo tests`, () => {
9696 expect ( steps . length ) . toBe ( 8 ) ;
9797 } ) ;
9898
99- test ( 'makefile partial' , async ( ) => {
99+ test ( 'makefile partial (without parents, object has no children) ' , async ( ) => {
100100 const makefile = new MakeProject ( targets . getCwd ( ) , targets , fs ) ;
101- makefile . setPartialOptions ( { partial : true , parents : true } ) ;
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 } ) ;
102163 await makefile . setupSettings ( ) ;
103164
104165 const resolvedObjects = targets . getResolvedObjects ( ) ;
@@ -116,6 +177,30 @@ describe(`pseudo tests`, () => {
116177 expect ( rules ) . toContain ( `$(PREPATH)/NEMP.FILE:` ) ;
117178 expect ( rules ) . toContain ( `$(PREPATH)/NEWEMP.PGM:` ) ;
118179 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:` ) ;
119204 } ) ;
120205
121206 test ( 'ibmi-bob rules' , ( ) => {
0 commit comments