@@ -139,7 +139,7 @@ describe('ProgramCall Class Unit Tests', () => {
139
139
const pgm = new ProgramCall ( 'MYPGM' , { lib : 'MYLIB' , func : 'MY_PROCEDURE' } ) ;
140
140
141
141
pgm . addParam ( { value : '' , type : '1A' , by : 'val' } ) ;
142
- pgm . addReturn ( ' ', '2A' , 'output' ) ;
142
+ pgm . addReturn ( { name : 'output ', type : '2A' , value : '' } ) ;
143
143
144
144
const lookAtXML = pgm . toXML ( ) ;
145
145
expect ( lookAtXML ) . to . match ( / < p a r m .* b y = ' v a l ' .* > / ) ;
@@ -156,7 +156,7 @@ describe('ProgramCall Class Unit Tests', () => {
156
156
pgm . addParam ( {
157
157
name : 'inds' , type : 'ds' , by : 'val' , fields : params ,
158
158
} ) ;
159
- pgm . addReturn ( ' ', '2A' , { name : 'output ' } ) ;
159
+ pgm . addReturn ( { name : 'output ', type : '2A' , value : '' } ) ;
160
160
161
161
const lookAtXML = pgm . toXML ( ) ;
162
162
expect ( lookAtXML ) . to . match ( / < p a r m .* b y = ' v a l ' .* > / ) ;
@@ -168,7 +168,7 @@ describe('ProgramCall Class Unit Tests', () => {
168
168
pgm . addParam ( {
169
169
value : '' , type : '1A' , by : 'val' , io : 'both' ,
170
170
} ) ;
171
- pgm . addReturn ( ' ', '2A' , { name : 'output ' } ) ;
171
+ pgm . addReturn ( { name : 'output ', type : '2A' , value : '' } ) ;
172
172
173
173
const lookAtXML = pgm . toXML ( ) ;
174
174
expect ( lookAtXML ) . to . match ( / < p a r m .* b y = ' v a l ' .* > / ) ;
@@ -186,7 +186,7 @@ describe('ProgramCall Class Unit Tests', () => {
186
186
pgm . addParam ( {
187
187
name : 'inds' , type : 'ds' , by : 'val' , io : 'both' , fields : params ,
188
188
} ) ;
189
- pgm . addReturn ( ' ', '2A' , { name : 'output ' } ) ;
189
+ pgm . addReturn ( { name : 'output ', type : '2A' , value : '' } ) ;
190
190
191
191
const lookAtXML = pgm . toXML ( ) ;
192
192
expect ( lookAtXML ) . to . match ( / < p a r m .* b y = ' v a l ' .* > / ) ;
@@ -204,12 +204,32 @@ describe('ProgramCall Class Unit Tests', () => {
204
204
error : 'fast' ,
205
205
} ) ;
206
206
207
- pgm . addReturn ( '0 ', '20A' ) ;
207
+ pgm . addReturn ( { type : '20A ', value : '0' } ) ;
208
208
209
209
const expectedXML = '<pgm name=\'QTOCNETSTS\' lib=\'QSYS\' func=\'QtoRtvTCPA\' '
210
210
+ 'error=\'fast\'><return><data type=\'20A\'>0</data></return></pgm>' ;
211
211
212
212
expect ( pgm . toXML ( ) ) . to . equal ( expectedXML ) ;
213
213
} ) ;
214
+
215
+ it ( 'appends return with ds to pgm xml' , ( ) => {
216
+ const pgm = new ProgramCall ( 'TEST' ) ;
217
+
218
+ const ds = {
219
+ name : 'test_ds' ,
220
+ type : 'ds' ,
221
+ io : 'out' ,
222
+ fields : [
223
+ { type : '10i0' , value : 0 } ,
224
+ { type : '10A' , value : '' } ,
225
+ ] ,
226
+ } ;
227
+ pgm . addReturn ( ds ) ;
228
+
229
+ const expectedXML = "<pgm name='TEST' error='fast'><return><ds name='test_ds'>"
230
+ + "<data type='10i0'>0</data><data type='10A'></data></ds></return></pgm>" ;
231
+
232
+ expect ( pgm . toXML ( ) ) . to . equal ( expectedXML ) ;
233
+ } ) ;
214
234
} ) ;
215
235
} ) ;
0 commit comments