itoolkit 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +37 -11
- package/CHANGELOG.md +34 -1
- package/README.md +8 -8
- package/lib/Connection.js +0 -1
- package/lib/Deprecated.js +3 -4
- package/lib/ProgramCall.js +2 -2
- package/lib/transports/httpTransport.js +2 -2
- package/lib/transports/idbTransport.js +23 -11
- package/lib/transports/odbcTransport.js +16 -2
- package/lib/transports/sshTransport.js +4 -5
- package/package.json +15 -14
- package/test/README.md +2 -4
- package/test/functional/CommandCallFunctional.js +20 -12
- package/test/functional/ProgramCallFunctional.js +6 -66
- package/test/functional/checkObjectExists.js +12 -1
- package/test/functional/checkVersion.js +17 -0
- package/test/functional/deprecated/commandsFunctional.js +20 -11
- package/test/functional/deprecated/iDataQueueFunctional.js +10 -11
- package/test/functional/deprecated/iNetworkFunctional.js +8 -9
- package/test/functional/deprecated/iObjFunctional.js +18 -19
- package/test/functional/deprecated/iPgmFunctional.js +6 -42
- package/test/functional/deprecated/iProdFunctional.js +10 -11
- package/test/functional/deprecated/iSqlFunctional.js +30 -32
- package/test/functional/deprecated/iUserSpaceFunctional.js +29 -18
- package/test/functional/deprecated/iWorkFunctional.js +61 -59
- package/test/functional/iDataQueueFunctional.js +8 -9
- package/test/functional/iNetworkFunctional.js +6 -8
- package/test/functional/iObjFunctional.js +16 -17
- package/test/functional/iProdFunctional.js +8 -9
- package/test/functional/iSqlFunctional.js +30 -31
- package/test/functional/iUserSpaceFunctional.js +27 -16
- package/test/functional/iWorkFunctional.js +29 -33
- package/test/unit/CommandCallUnit.js +10 -11
- package/test/unit/ConnectionUnit.js +12 -19
- package/test/unit/ProgamCallUnit.js +27 -25
- package/test/unit/deprecated/commandsUnit.js +10 -11
- package/test/unit/deprecated/iConnUnit.js +12 -16
- package/test/unit/deprecated/iPgmUnit.js +25 -21
- package/test/unit/deprecated/iSqlUnit.js +69 -70
- package/test/unit/deprecated/xmlToJsonUnit.js +6 -9
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
16
16
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
17
17
|
|
|
18
|
-
/* eslint-env mocha */
|
|
19
18
|
/* eslint-disable new-cap */
|
|
20
19
|
|
|
21
20
|
const { expect } = require('chai');
|
|
@@ -23,13 +22,13 @@ const { parseString } = require('xml2js');
|
|
|
23
22
|
const { iSql, Connection } = require('../../lib/itoolkit');
|
|
24
23
|
const { config, printConfig } = require('./config');
|
|
25
24
|
|
|
26
|
-
describe('iSql Functional Tests', ()
|
|
27
|
-
before(()
|
|
25
|
+
describe('iSql Functional Tests', function () {
|
|
26
|
+
before(function () {
|
|
28
27
|
printConfig();
|
|
29
28
|
});
|
|
30
29
|
|
|
31
|
-
describe('prepare & execute', ()
|
|
32
|
-
it('prepares & executes stored procedure then fetch results', (done)
|
|
30
|
+
describe('prepare & execute', function () {
|
|
31
|
+
it('prepares & executes stored procedure then fetch results', function (done) {
|
|
33
32
|
const connection = new Connection(config);
|
|
34
33
|
|
|
35
34
|
const sql = new iSql();
|
|
@@ -62,8 +61,8 @@ describe('iSql Functional Tests', () => {
|
|
|
62
61
|
});
|
|
63
62
|
});
|
|
64
63
|
|
|
65
|
-
describe('addQuery & fetch', ()
|
|
66
|
-
it('runs a query and fetches results', (done)
|
|
64
|
+
describe('addQuery & fetch', function () {
|
|
65
|
+
it('runs a query and fetches results', function (done) {
|
|
67
66
|
const connection = new Connection(config);
|
|
68
67
|
|
|
69
68
|
const sql = new iSql();
|
|
@@ -88,8 +87,8 @@ describe('iSql Functional Tests', () => {
|
|
|
88
87
|
});
|
|
89
88
|
});
|
|
90
89
|
|
|
91
|
-
describe('added test to ensure issue #11 was resolved', ()
|
|
92
|
-
it('should parse SQL result set empty data tags correctly', (done)
|
|
90
|
+
describe('added test to ensure issue #11 was resolved', function () {
|
|
91
|
+
it('should parse SQL result set empty data tags correctly', function (done) {
|
|
93
92
|
const connection = new Connection(config);
|
|
94
93
|
|
|
95
94
|
const sql = new iSql();
|
|
@@ -115,8 +114,8 @@ describe('iSql Functional Tests', () => {
|
|
|
115
114
|
});
|
|
116
115
|
});
|
|
117
116
|
|
|
118
|
-
describe('tables', ()
|
|
119
|
-
it('returns meta data for specified table', (done)
|
|
117
|
+
describe('tables', function () {
|
|
118
|
+
it('returns meta data for specified table', function (done) {
|
|
120
119
|
const connection = new Connection(config);
|
|
121
120
|
|
|
122
121
|
const sql = new iSql();
|
|
@@ -140,8 +139,8 @@ describe('iSql Functional Tests', () => {
|
|
|
140
139
|
});
|
|
141
140
|
});
|
|
142
141
|
|
|
143
|
-
describe('tablePriv', ()
|
|
144
|
-
it('returns privilege data for a table', (done)
|
|
142
|
+
describe('tablePriv', function () {
|
|
143
|
+
it('returns privilege data for a table', function (done) {
|
|
145
144
|
const connection = new Connection(config);
|
|
146
145
|
|
|
147
146
|
const sql = new iSql();
|
|
@@ -167,8 +166,8 @@ describe('iSql Functional Tests', () => {
|
|
|
167
166
|
});
|
|
168
167
|
});
|
|
169
168
|
|
|
170
|
-
describe('columns', ()
|
|
171
|
-
it('returns meta data for a column', (done)
|
|
169
|
+
describe('columns', function () {
|
|
170
|
+
it('returns meta data for a column', function (done) {
|
|
172
171
|
const connection = new Connection(config);
|
|
173
172
|
|
|
174
173
|
const sql = new iSql();
|
|
@@ -205,8 +204,8 @@ describe('iSql Functional Tests', () => {
|
|
|
205
204
|
});
|
|
206
205
|
});
|
|
207
206
|
|
|
208
|
-
describe('columnPriv', ()
|
|
209
|
-
it('returns privilege data for a column', (done)
|
|
207
|
+
describe('columnPriv', function () {
|
|
208
|
+
it('returns privilege data for a column', function (done) {
|
|
210
209
|
const connection = new Connection(config);
|
|
211
210
|
|
|
212
211
|
const sql = new iSql();
|
|
@@ -234,8 +233,8 @@ describe('iSql Functional Tests', () => {
|
|
|
234
233
|
});
|
|
235
234
|
});
|
|
236
235
|
|
|
237
|
-
describe('procedures', ()
|
|
238
|
-
it('returns meta data on for a procedure', (done)
|
|
236
|
+
describe('procedures', function () {
|
|
237
|
+
it('returns meta data on for a procedure', function (done) {
|
|
239
238
|
const connection = new Connection(config);
|
|
240
239
|
|
|
241
240
|
const sql = new iSql();
|
|
@@ -262,8 +261,8 @@ describe('iSql Functional Tests', () => {
|
|
|
262
261
|
});
|
|
263
262
|
});
|
|
264
263
|
|
|
265
|
-
describe('pColumns', ()
|
|
266
|
-
it('returns meta data for procedure column', (done)
|
|
264
|
+
describe('pColumns', function () {
|
|
265
|
+
it('returns meta data for procedure column', function (done) {
|
|
267
266
|
const connection = new Connection(config);
|
|
268
267
|
|
|
269
268
|
const sql = new iSql();
|
|
@@ -301,8 +300,8 @@ describe('iSql Functional Tests', () => {
|
|
|
301
300
|
});
|
|
302
301
|
});
|
|
303
302
|
|
|
304
|
-
describe('primaryKeys', ()
|
|
305
|
-
it('returns meta data for a primary key', (done)
|
|
303
|
+
describe('primaryKeys', function () {
|
|
304
|
+
it('returns meta data for a primary key', function (done) {
|
|
306
305
|
const connection = new Connection(config);
|
|
307
306
|
|
|
308
307
|
const sql = new iSql();
|
|
@@ -327,8 +326,8 @@ describe('iSql Functional Tests', () => {
|
|
|
327
326
|
});
|
|
328
327
|
});
|
|
329
328
|
|
|
330
|
-
describe('foreignKeys', ()
|
|
331
|
-
it('returns meta data for a foreign key', (done)
|
|
329
|
+
describe('foreignKeys', function () {
|
|
330
|
+
it('returns meta data for a foreign key', function (done) {
|
|
332
331
|
const connection = new Connection(config);
|
|
333
332
|
|
|
334
333
|
const sql = new iSql();
|
|
@@ -362,8 +361,8 @@ describe('iSql Functional Tests', () => {
|
|
|
362
361
|
});
|
|
363
362
|
});
|
|
364
363
|
|
|
365
|
-
describe('statistics', ()
|
|
366
|
-
it('returns stats info for table', (done)
|
|
364
|
+
describe('statistics', function () {
|
|
365
|
+
it('returns stats info for table', function (done) {
|
|
367
366
|
const connection = new Connection(config);
|
|
368
367
|
|
|
369
368
|
const sql = new iSql();
|
|
@@ -395,10 +394,10 @@ describe('iSql Functional Tests', () => {
|
|
|
395
394
|
});
|
|
396
395
|
});
|
|
397
396
|
|
|
398
|
-
describe.skip('special', ()
|
|
397
|
+
describe.skip('special', function () {
|
|
399
398
|
// TODO: find passing case
|
|
400
399
|
// Below test fails with error code 9- argument value not valid
|
|
401
|
-
it.skip('returns meta data for special columns', (done)
|
|
400
|
+
it.skip('returns meta data for special columns', function (done) {
|
|
402
401
|
// [catalog, schema, table, row | transaction |session, no | nullable]
|
|
403
402
|
const connection = new Connection(config);
|
|
404
403
|
|
|
@@ -419,9 +418,9 @@ describe('iSql Functional Tests', () => {
|
|
|
419
418
|
});
|
|
420
419
|
});
|
|
421
420
|
|
|
422
|
-
describe.skip('rowCount', ()
|
|
421
|
+
describe.skip('rowCount', function () {
|
|
423
422
|
// Skip for now need to create a table for this test to insert to.
|
|
424
|
-
it.skip('returns the number of rows affected by statement', (done)
|
|
423
|
+
it.skip('returns the number of rows affected by statement', function (done) {
|
|
425
424
|
const connection = new Connection(config);
|
|
426
425
|
|
|
427
426
|
const sql = new iSql();
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
16
16
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
17
17
|
|
|
18
|
-
/* eslint-env mocha */
|
|
19
18
|
/* eslint-disable new-cap */
|
|
20
19
|
|
|
21
20
|
const { expect } = require('chai');
|
|
@@ -38,15 +37,15 @@ function generateRandomName() {
|
|
|
38
37
|
return name.toUpperCase();
|
|
39
38
|
}
|
|
40
39
|
|
|
41
|
-
describe('UserSpace Functional Tests', ()
|
|
42
|
-
before(()
|
|
40
|
+
describe('UserSpace Functional Tests', function () {
|
|
41
|
+
before(function () {
|
|
43
42
|
printConfig();
|
|
44
43
|
});
|
|
45
44
|
|
|
46
45
|
let userSpaceName;
|
|
47
46
|
|
|
48
|
-
describe('createUserSpace', ()
|
|
49
|
-
it('creates a user space', (done)
|
|
47
|
+
describe('createUserSpace', function () {
|
|
48
|
+
it('creates a user space', function (done) {
|
|
50
49
|
const connection = new Connection(config);
|
|
51
50
|
|
|
52
51
|
const userSpace = new iUserSpace(connection);
|
|
@@ -55,18 +54,25 @@ describe('UserSpace Functional Tests', () => {
|
|
|
55
54
|
|
|
56
55
|
const name = generateRandomName();
|
|
57
56
|
|
|
58
|
-
userSpace.createUserSpace(
|
|
59
|
-
|
|
57
|
+
userSpace.createUserSpace(
|
|
58
|
+
name,
|
|
59
|
+
lib,
|
|
60
|
+
'LOG',
|
|
61
|
+
50,
|
|
62
|
+
'*EXCLUDE',
|
|
63
|
+
description,
|
|
64
|
+
(error, output) => {
|
|
60
65
|
expect(error).to.equal(null);
|
|
61
66
|
expect(output).to.be.a('boolean').and.to.equal(true);
|
|
62
67
|
userSpaceName = name;
|
|
63
68
|
done();
|
|
64
|
-
}
|
|
69
|
+
},
|
|
70
|
+
);
|
|
65
71
|
});
|
|
66
72
|
});
|
|
67
73
|
|
|
68
|
-
describe('setUserSpaceData', ()
|
|
69
|
-
it('sets data within the user space', (done)
|
|
74
|
+
describe('setUserSpaceData', function () {
|
|
75
|
+
it('sets data within the user space', function (done) {
|
|
70
76
|
if (!userSpaceName) {
|
|
71
77
|
this.skip();
|
|
72
78
|
}
|
|
@@ -77,17 +83,22 @@ describe('UserSpace Functional Tests', () => {
|
|
|
77
83
|
|
|
78
84
|
const msg = 'Hello from userspace!';
|
|
79
85
|
|
|
80
|
-
userSpace.setUserSpaceData(
|
|
86
|
+
userSpace.setUserSpaceData(
|
|
87
|
+
userSpaceName,
|
|
88
|
+
lib,
|
|
89
|
+
msg.length,
|
|
90
|
+
msg,
|
|
81
91
|
(error, output) => {
|
|
82
92
|
expect(error).to.equal(null);
|
|
83
93
|
expect(output).to.be.a('boolean').and.to.equal(true);
|
|
84
94
|
done();
|
|
85
|
-
}
|
|
95
|
+
},
|
|
96
|
+
);
|
|
86
97
|
});
|
|
87
98
|
});
|
|
88
99
|
|
|
89
|
-
describe('getUserSpaceData', ()
|
|
90
|
-
it('returns specified length of data', (done)
|
|
100
|
+
describe('getUserSpaceData', function () {
|
|
101
|
+
it('returns specified length of data', function (done) {
|
|
91
102
|
if (!userSpaceName) {
|
|
92
103
|
this.skip();
|
|
93
104
|
}
|
|
@@ -104,8 +115,8 @@ describe('UserSpace Functional Tests', () => {
|
|
|
104
115
|
});
|
|
105
116
|
});
|
|
106
117
|
|
|
107
|
-
describe('deleteUserSpace', ()
|
|
108
|
-
it('removes a user space', (done)
|
|
118
|
+
describe('deleteUserSpace', function () {
|
|
119
|
+
it('removes a user space', function (done) {
|
|
109
120
|
if (!userSpaceName) {
|
|
110
121
|
this.skip();
|
|
111
122
|
}
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
16
16
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
17
17
|
|
|
18
|
-
/* eslint-env mocha */
|
|
19
18
|
/* eslint-disable new-cap */
|
|
20
19
|
|
|
21
20
|
const { expect } = require('chai');
|
|
@@ -23,13 +22,13 @@ const { Connection, iWork } = require('../../lib/itoolkit');
|
|
|
23
22
|
const { config, printConfig } = require('./config');
|
|
24
23
|
const { checkObjectExists } = require('./checkObjectExists');
|
|
25
24
|
|
|
26
|
-
describe('iWork Functional Tests', ()
|
|
27
|
-
before(()
|
|
25
|
+
describe('iWork Functional Tests', function () {
|
|
26
|
+
before(function () {
|
|
28
27
|
printConfig();
|
|
29
28
|
});
|
|
30
29
|
|
|
31
|
-
describe('getSysValue', ()
|
|
32
|
-
it('returns the value of system variable', (done)
|
|
30
|
+
describe('getSysValue', function () {
|
|
31
|
+
it('returns the value of system variable', function (done) {
|
|
33
32
|
const connection = new Connection(config);
|
|
34
33
|
|
|
35
34
|
const work = new iWork(connection);
|
|
@@ -41,7 +40,7 @@ describe('iWork Functional Tests', () => {
|
|
|
41
40
|
});
|
|
42
41
|
});
|
|
43
42
|
|
|
44
|
-
it('returns an error when the specified system value is invalid', (done)
|
|
43
|
+
it('returns an error when the specified system value is invalid', function (done) {
|
|
45
44
|
const connection = new Connection(config);
|
|
46
45
|
|
|
47
46
|
const work = new iWork(connection);
|
|
@@ -53,8 +52,8 @@ describe('iWork Functional Tests', () => {
|
|
|
53
52
|
});
|
|
54
53
|
});
|
|
55
54
|
|
|
56
|
-
describe('getSysStatus', ()
|
|
57
|
-
it('returns basic system status information about the signed-on users and batch jobs', (done)
|
|
55
|
+
describe('getSysStatus', function () {
|
|
56
|
+
it('returns basic system status information about the signed-on users and batch jobs', function (done) {
|
|
58
57
|
const connection = new Connection(config);
|
|
59
58
|
const work = new iWork(connection);
|
|
60
59
|
|
|
@@ -82,8 +81,8 @@ describe('iWork Functional Tests', () => {
|
|
|
82
81
|
});
|
|
83
82
|
});
|
|
84
83
|
|
|
85
|
-
describe('getSysStatusExt', ()
|
|
86
|
-
it('returns more detailed system status info', (done)
|
|
84
|
+
describe('getSysStatusExt', function () {
|
|
85
|
+
it('returns more detailed system status info', function (done) {
|
|
87
86
|
const connection = new Connection(config);
|
|
88
87
|
|
|
89
88
|
const work = new iWork(connection);
|
|
@@ -127,8 +126,8 @@ describe('iWork Functional Tests', () => {
|
|
|
127
126
|
});
|
|
128
127
|
});
|
|
129
128
|
|
|
130
|
-
describe('getJobStatus', ()
|
|
131
|
-
it('returns status of specified job', (done)
|
|
129
|
+
describe('getJobStatus', function () {
|
|
130
|
+
it('returns status of specified job', function (done) {
|
|
132
131
|
const connection = new Connection(config);
|
|
133
132
|
|
|
134
133
|
const work = new iWork(connection);
|
|
@@ -143,8 +142,8 @@ describe('iWork Functional Tests', () => {
|
|
|
143
142
|
});
|
|
144
143
|
});
|
|
145
144
|
|
|
146
|
-
describe('getJobInfo', ()
|
|
147
|
-
it('returns info on specfed job', (done)
|
|
145
|
+
describe('getJobInfo', function () {
|
|
146
|
+
it('returns info on specfed job', function (done) {
|
|
148
147
|
const connection = new Connection(config);
|
|
149
148
|
|
|
150
149
|
const work = new iWork(connection);
|
|
@@ -192,27 +191,24 @@ describe('iWork Functional Tests', () => {
|
|
|
192
191
|
});
|
|
193
192
|
});
|
|
194
193
|
|
|
195
|
-
describe('getDataArea', ()
|
|
196
|
-
|
|
194
|
+
describe('getDataArea', function () {
|
|
195
|
+
it('returns contents of a data area', function (done) {
|
|
197
196
|
checkObjectExists(config, 'TESTDA', '*DTAARA', (error) => {
|
|
198
197
|
if (error) { throw error; }
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
expect(output).to.have.a.property('Number_of_decimal_positions');
|
|
214
|
-
expect(output).to.have.a.property('Value');
|
|
215
|
-
done();
|
|
198
|
+
const connection = new Connection(config);
|
|
199
|
+
|
|
200
|
+
const work = new iWork(connection);
|
|
201
|
+
|
|
202
|
+
work.getDataArea('NODETKTEST', 'TESTDA', 20, (error2, output) => {
|
|
203
|
+
expect(error2).to.equal(null);
|
|
204
|
+
expect(output).to.be.an('Object');
|
|
205
|
+
expect(output).to.have.a.property('Type_of_value_returned');
|
|
206
|
+
expect(output).to.have.a.property('Library_name');
|
|
207
|
+
expect(output).to.have.a.property('Length_of_value_returned');
|
|
208
|
+
expect(output).to.have.a.property('Number_of_decimal_positions');
|
|
209
|
+
expect(output).to.have.a.property('Value');
|
|
210
|
+
done();
|
|
211
|
+
});
|
|
216
212
|
});
|
|
217
213
|
});
|
|
218
214
|
});
|
|
@@ -15,13 +15,12 @@
|
|
|
15
15
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
16
16
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
17
17
|
|
|
18
|
-
/* eslint-env mocha */
|
|
19
18
|
const { expect } = require('chai');
|
|
20
19
|
const { CommandCall } = require('../../lib/itoolkit');
|
|
21
20
|
|
|
22
|
-
describe('Command Call Unit Tests', ()
|
|
23
|
-
describe('SH command tests', ()
|
|
24
|
-
it('accepts command input and returns <sh> XML output', ()
|
|
21
|
+
describe('Command Call Unit Tests', function () {
|
|
22
|
+
describe('SH command tests', function () {
|
|
23
|
+
it('accepts command input and returns <sh> XML output', function () {
|
|
25
24
|
const command = new CommandCall({ command: 'ls -lah', type: 'sh' });
|
|
26
25
|
|
|
27
26
|
const expectedXML = '<sh error=\'fast\'>ls -lah</sh>';
|
|
@@ -29,7 +28,7 @@ describe('Command Call Unit Tests', () => {
|
|
|
29
28
|
expect(command.toXML()).to.be.a('string').and.to.equal(expectedXML);
|
|
30
29
|
});
|
|
31
30
|
|
|
32
|
-
it('accepts command input and options returns <sh> with optional attributes', ()
|
|
31
|
+
it('accepts command input and options returns <sh> with optional attributes', function () {
|
|
33
32
|
const options = {
|
|
34
33
|
error: 'on', before: '65535', after: '37', rows: 'on',
|
|
35
34
|
};
|
|
@@ -42,8 +41,8 @@ describe('Command Call Unit Tests', () => {
|
|
|
42
41
|
});
|
|
43
42
|
});
|
|
44
43
|
|
|
45
|
-
describe('CL command tests', ()
|
|
46
|
-
it('accepts command input and returns <cmd> XML output', ()
|
|
44
|
+
describe('CL command tests', function () {
|
|
45
|
+
it('accepts command input and returns <cmd> XML output', function () {
|
|
47
46
|
const command = new CommandCall({ command: 'RTVJOBA USRLIBL(?) SYSLIBL(?)', type: 'cl' });
|
|
48
47
|
|
|
49
48
|
const expectedXML = '<cmd exec=\'rexx\' error=\'fast\'>RTVJOBA USRLIBL(?) SYSLIBL(?)</cmd>';
|
|
@@ -51,7 +50,7 @@ describe('Command Call Unit Tests', () => {
|
|
|
51
50
|
expect(command.toXML()).to.be.a('string').and.to.equal(expectedXML);
|
|
52
51
|
});
|
|
53
52
|
|
|
54
|
-
it('accepts command input and options returns <cmd> with optional attributes', ()
|
|
53
|
+
it('accepts command input and options returns <cmd> with optional attributes', function () {
|
|
55
54
|
const options = {
|
|
56
55
|
exec: 'cmd', error: 'on', before: '65535', after: '37', hex: 'on',
|
|
57
56
|
};
|
|
@@ -65,8 +64,8 @@ describe('Command Call Unit Tests', () => {
|
|
|
65
64
|
});
|
|
66
65
|
});
|
|
67
66
|
|
|
68
|
-
describe('QSH command tests', ()
|
|
69
|
-
it('accepts command input and returns <qsh> XML output', ()
|
|
67
|
+
describe('QSH command tests', function () {
|
|
68
|
+
it('accepts command input and returns <qsh> XML output', function () {
|
|
70
69
|
const command = new CommandCall({ command: 'ls -lah', type: 'qsh' });
|
|
71
70
|
|
|
72
71
|
const expectedXML = '<qsh error=\'fast\'>ls -lah</qsh>';
|
|
@@ -74,7 +73,7 @@ describe('Command Call Unit Tests', () => {
|
|
|
74
73
|
expect(command.toXML()).to.be.a('string').and.to.equal(expectedXML);
|
|
75
74
|
});
|
|
76
75
|
|
|
77
|
-
it('accepts command input and options returns <qsh> with optional attributes', ()
|
|
76
|
+
it('accepts command input and options returns <qsh> with optional attributes', function () {
|
|
78
77
|
const options = {
|
|
79
78
|
error: 'on', before: '65535', after: '37', rows: 'on',
|
|
80
79
|
};
|
|
@@ -15,16 +15,13 @@
|
|
|
15
15
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
16
16
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
17
17
|
|
|
18
|
-
/* eslint-env mocha */
|
|
19
|
-
/* eslint-disable new-cap */
|
|
20
|
-
|
|
21
18
|
const { expect } = require('chai');
|
|
22
19
|
const sinon = require('sinon');
|
|
23
20
|
const { Connection, CommandCall } = require('../../lib/itoolkit');
|
|
24
21
|
|
|
25
|
-
describe('Connection Class Unit Tests', ()
|
|
26
|
-
describe('constructor', ()
|
|
27
|
-
it('creates and returns an instance of Connection with idb transport', ()
|
|
22
|
+
describe('Connection Class Unit Tests', function () {
|
|
23
|
+
describe('constructor', function () {
|
|
24
|
+
it('creates and returns an instance of Connection with idb transport', function () {
|
|
28
25
|
const options = {
|
|
29
26
|
transport: 'idb',
|
|
30
27
|
transportOptions: {
|
|
@@ -46,7 +43,7 @@ describe('Connection Class Unit Tests', () => {
|
|
|
46
43
|
expect(connection.commandList.length).to.equal(0);
|
|
47
44
|
});
|
|
48
45
|
|
|
49
|
-
it('creates and returns an instance of Connection with rest transport', ()
|
|
46
|
+
it('creates and returns an instance of Connection with rest transport', function () {
|
|
50
47
|
const options = {
|
|
51
48
|
transport: 'rest',
|
|
52
49
|
transportOptions: {
|
|
@@ -79,8 +76,8 @@ describe('Connection Class Unit Tests', () => {
|
|
|
79
76
|
});
|
|
80
77
|
});
|
|
81
78
|
|
|
82
|
-
describe('add', ()
|
|
83
|
-
it('appends to xml service request to the command list using Connection class', ()
|
|
79
|
+
describe('add', function () {
|
|
80
|
+
it('appends to xml service request to the command list using Connection class', function () {
|
|
84
81
|
const options = {
|
|
85
82
|
transport: 'idb',
|
|
86
83
|
transportOptions: {
|
|
@@ -97,9 +94,8 @@ describe('Connection Class Unit Tests', () => {
|
|
|
97
94
|
});
|
|
98
95
|
});
|
|
99
96
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
it('turns verbose mode on/off using Connection class', () => {
|
|
97
|
+
describe('debug', function () {
|
|
98
|
+
it('turns verbose mode on/off using Connection class', function () {
|
|
103
99
|
const options = {
|
|
104
100
|
transport: 'idb',
|
|
105
101
|
transportOptions: {
|
|
@@ -117,9 +113,8 @@ describe('Connection Class Unit Tests', () => {
|
|
|
117
113
|
});
|
|
118
114
|
});
|
|
119
115
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
it('returns conn (object) property from Connection instance', () => {
|
|
116
|
+
describe('getTransportOptions', function () {
|
|
117
|
+
it('returns conn (object) property from Connection instance', function () {
|
|
123
118
|
const options = {
|
|
124
119
|
transport: 'rest',
|
|
125
120
|
transportOptions: {
|
|
@@ -138,7 +133,6 @@ describe('Connection Class Unit Tests', () => {
|
|
|
138
133
|
|
|
139
134
|
const transportOptions = connection.getTransportOptions();
|
|
140
135
|
|
|
141
|
-
|
|
142
136
|
expect(transportOptions).to.be.an('Object');
|
|
143
137
|
expect(transportOptions.database).to.equal(options.transportOptions.database);
|
|
144
138
|
expect(transportOptions.username).to.equal(options.transportOptions.username);
|
|
@@ -149,9 +143,8 @@ describe('Connection Class Unit Tests', () => {
|
|
|
149
143
|
});
|
|
150
144
|
});
|
|
151
145
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
it('(Connection) invokes transport to execute xml input and returns xml output in callback', () => {
|
|
146
|
+
describe('run', function () {
|
|
147
|
+
it('(Connection) invokes transport to execute xml input and returns xml output in callback', function () {
|
|
155
148
|
const options = {
|
|
156
149
|
transport: 'idb',
|
|
157
150
|
transportOptions: {
|
|
@@ -15,9 +15,6 @@
|
|
|
15
15
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
16
16
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
17
17
|
|
|
18
|
-
/* eslint-env mocha */
|
|
19
|
-
/* eslint-disable new-cap */
|
|
20
|
-
|
|
21
18
|
const { expect } = require('chai');
|
|
22
19
|
const { ProgramCall } = require('../../lib/itoolkit');
|
|
23
20
|
|
|
@@ -38,22 +35,24 @@ const errno = [
|
|
|
38
35
|
{ type: '1A', value: '' },
|
|
39
36
|
];
|
|
40
37
|
|
|
41
|
-
describe('ProgramCall Class Unit Tests', ()
|
|
42
|
-
describe('constructor', ()
|
|
43
|
-
it('creates and returns an instance of ProgramCall with lib and function set', ()
|
|
38
|
+
describe('ProgramCall Class Unit Tests', function () {
|
|
39
|
+
describe('constructor', function () {
|
|
40
|
+
it('creates and returns an instance of ProgramCall with lib and function set', function () {
|
|
44
41
|
const pgm = new ProgramCall('QTOCNETSTS');
|
|
45
42
|
expect(pgm).to.be.instanceOf(ProgramCall);
|
|
46
43
|
});
|
|
47
44
|
});
|
|
48
45
|
|
|
49
|
-
describe('toXML', ()
|
|
50
|
-
it('returns pgm XML', ()
|
|
51
|
-
const pgm = new ProgramCall(
|
|
46
|
+
describe('toXML', function () {
|
|
47
|
+
it('returns pgm XML', function () {
|
|
48
|
+
const pgm = new ProgramCall(
|
|
49
|
+
'QTOCNETSTS',
|
|
52
50
|
{
|
|
53
51
|
lib: 'QSYS',
|
|
54
52
|
func: 'QtoRtvTCPA',
|
|
55
53
|
error: 'on',
|
|
56
|
-
}
|
|
54
|
+
},
|
|
55
|
+
);
|
|
57
56
|
|
|
58
57
|
const expectedXML = '<pgm name=\'QTOCNETSTS\' lib=\'QSYS\' func=\'QtoRtvTCPA\' error=\'on\'></pgm>';
|
|
59
58
|
|
|
@@ -61,14 +60,16 @@ describe('ProgramCall Class Unit Tests', () => {
|
|
|
61
60
|
});
|
|
62
61
|
});
|
|
63
62
|
|
|
64
|
-
describe('addParam', ()
|
|
65
|
-
it('appends param to pgm xml', ()
|
|
66
|
-
const pgm = new ProgramCall(
|
|
63
|
+
describe('addParam', function () {
|
|
64
|
+
it('appends param to pgm xml', function () {
|
|
65
|
+
const pgm = new ProgramCall(
|
|
66
|
+
'QTOCNETSTS',
|
|
67
67
|
{
|
|
68
68
|
lib: 'QSYS',
|
|
69
69
|
func: 'QtoRtvTCPA',
|
|
70
70
|
error: 'fast',
|
|
71
|
-
}
|
|
71
|
+
},
|
|
72
|
+
);
|
|
72
73
|
|
|
73
74
|
pgm.addParam({ type: 'ds', io: 'out', fields: outBuf });
|
|
74
75
|
|
|
@@ -135,7 +136,7 @@ describe('ProgramCall Class Unit Tests', () => {
|
|
|
135
136
|
expect(pgm.toXML()).to.equal(expectedXML);
|
|
136
137
|
});
|
|
137
138
|
|
|
138
|
-
it('regular <parm> contains by=\'val\'', ()
|
|
139
|
+
it('regular <parm> contains by=\'val\'', function () {
|
|
139
140
|
const pgm = new ProgramCall('MYPGM', { lib: 'MYLIB', func: 'MY_PROCEDURE' });
|
|
140
141
|
|
|
141
142
|
pgm.addParam({ value: '', type: '1A', by: 'val' });
|
|
@@ -145,7 +146,7 @@ describe('ProgramCall Class Unit Tests', () => {
|
|
|
145
146
|
expect(lookAtXML).to.match(/<parm .*by='val'.*>/);
|
|
146
147
|
});
|
|
147
148
|
|
|
148
|
-
it('data structure <parm> contains by=\'val\'', ()
|
|
149
|
+
it('data structure <parm> contains by=\'val\'', function () {
|
|
149
150
|
const pgm = new ProgramCall('MYPGM', { lib: 'MYLIB', func: 'MY_PROCEDURE' });
|
|
150
151
|
|
|
151
152
|
const params = [
|
|
@@ -162,7 +163,7 @@ describe('ProgramCall Class Unit Tests', () => {
|
|
|
162
163
|
expect(lookAtXML).to.match(/<parm .*by='val'.*>/);
|
|
163
164
|
});
|
|
164
165
|
|
|
165
|
-
it('regular <parm> contains by=\'val\', with io=\'both\'', ()
|
|
166
|
+
it('regular <parm> contains by=\'val\', with io=\'both\'', function () {
|
|
166
167
|
const pgm = new ProgramCall('MYPGM', { lib: 'MYLIB', func: 'MY_PROCEDURE' });
|
|
167
168
|
|
|
168
169
|
pgm.addParam({
|
|
@@ -175,7 +176,7 @@ describe('ProgramCall Class Unit Tests', () => {
|
|
|
175
176
|
expect(lookAtXML).to.match(/<parm .*io='both'.*>/);
|
|
176
177
|
});
|
|
177
178
|
|
|
178
|
-
it('data structure <parm> contains by=\'val\', with io=\'both\'', ()
|
|
179
|
+
it('data structure <parm> contains by=\'val\', with io=\'both\'', function () {
|
|
179
180
|
const pgm = new ProgramCall('MYPGM', { lib: 'MYLIB', func: 'MY_PROCEDURE' });
|
|
180
181
|
|
|
181
182
|
const params = [
|
|
@@ -193,7 +194,7 @@ describe('ProgramCall Class Unit Tests', () => {
|
|
|
193
194
|
expect(lookAtXML).to.match(/<parm .*io='both'.*>/);
|
|
194
195
|
});
|
|
195
196
|
|
|
196
|
-
it('add nested data structure parameter', ()
|
|
197
|
+
it('add nested data structure parameter', function () {
|
|
197
198
|
const pgm = new ProgramCall('MYPGM', { lib: 'MYLIB' });
|
|
198
199
|
|
|
199
200
|
const nestedDs = {
|
|
@@ -238,15 +239,16 @@ describe('ProgramCall Class Unit Tests', () => {
|
|
|
238
239
|
});
|
|
239
240
|
});
|
|
240
241
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
242
|
+
describe('addReturn', function () {
|
|
243
|
+
it('appends return to pgm xml', function () {
|
|
244
|
+
const pgm = new ProgramCall(
|
|
245
|
+
'QTOCNETSTS',
|
|
245
246
|
{
|
|
246
247
|
lib: 'QSYS',
|
|
247
248
|
func: 'QtoRtvTCPA',
|
|
248
249
|
error: 'fast',
|
|
249
|
-
}
|
|
250
|
+
},
|
|
251
|
+
);
|
|
250
252
|
|
|
251
253
|
pgm.addReturn({ type: '20A', value: '0' });
|
|
252
254
|
|
|
@@ -256,7 +258,7 @@ describe('ProgramCall Class Unit Tests', () => {
|
|
|
256
258
|
expect(pgm.toXML()).to.equal(expectedXML);
|
|
257
259
|
});
|
|
258
260
|
|
|
259
|
-
it('appends return with ds to pgm xml', ()
|
|
261
|
+
it('appends return with ds to pgm xml', function () {
|
|
260
262
|
const pgm = new ProgramCall('TEST');
|
|
261
263
|
|
|
262
264
|
const ds = {
|