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.
Files changed (40) hide show
  1. package/.eslintrc.js +37 -11
  2. package/CHANGELOG.md +34 -1
  3. package/README.md +8 -8
  4. package/lib/Connection.js +0 -1
  5. package/lib/Deprecated.js +3 -4
  6. package/lib/ProgramCall.js +2 -2
  7. package/lib/transports/httpTransport.js +2 -2
  8. package/lib/transports/idbTransport.js +23 -11
  9. package/lib/transports/odbcTransport.js +16 -2
  10. package/lib/transports/sshTransport.js +4 -5
  11. package/package.json +15 -14
  12. package/test/README.md +2 -4
  13. package/test/functional/CommandCallFunctional.js +20 -12
  14. package/test/functional/ProgramCallFunctional.js +6 -66
  15. package/test/functional/checkObjectExists.js +12 -1
  16. package/test/functional/checkVersion.js +17 -0
  17. package/test/functional/deprecated/commandsFunctional.js +20 -11
  18. package/test/functional/deprecated/iDataQueueFunctional.js +10 -11
  19. package/test/functional/deprecated/iNetworkFunctional.js +8 -9
  20. package/test/functional/deprecated/iObjFunctional.js +18 -19
  21. package/test/functional/deprecated/iPgmFunctional.js +6 -42
  22. package/test/functional/deprecated/iProdFunctional.js +10 -11
  23. package/test/functional/deprecated/iSqlFunctional.js +30 -32
  24. package/test/functional/deprecated/iUserSpaceFunctional.js +29 -18
  25. package/test/functional/deprecated/iWorkFunctional.js +61 -59
  26. package/test/functional/iDataQueueFunctional.js +8 -9
  27. package/test/functional/iNetworkFunctional.js +6 -8
  28. package/test/functional/iObjFunctional.js +16 -17
  29. package/test/functional/iProdFunctional.js +8 -9
  30. package/test/functional/iSqlFunctional.js +30 -31
  31. package/test/functional/iUserSpaceFunctional.js +27 -16
  32. package/test/functional/iWorkFunctional.js +29 -33
  33. package/test/unit/CommandCallUnit.js +10 -11
  34. package/test/unit/ConnectionUnit.js +12 -19
  35. package/test/unit/ProgamCallUnit.js +27 -25
  36. package/test/unit/deprecated/commandsUnit.js +10 -11
  37. package/test/unit/deprecated/iConnUnit.js +12 -16
  38. package/test/unit/deprecated/iPgmUnit.js +25 -21
  39. package/test/unit/deprecated/iSqlUnit.js +69 -70
  40. package/test/unit/deprecated/xmlToJsonUnit.js +6 -9
@@ -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 { iSh, iQsh, iCmd } = require('../../../lib/itoolkit');
21
20
 
22
- describe('iSh, iCmd, iQsh, Unit Tests', () => {
23
- describe('iSh function', () => {
24
- it('accepts command input and returns <sh> XML output', () => {
21
+ describe('iSh, iCmd, iQsh, Unit Tests', function () {
22
+ describe('iSh function', function () {
23
+ it('accepts command input and returns <sh> XML output', function () {
25
24
  const sh = iSh('ls -lah');
26
25
 
27
26
  const expectedXML = '<sh error=\'fast\'>ls -lah</sh>';
@@ -29,7 +28,7 @@ describe('iSh, iCmd, iQsh, Unit Tests', () => {
29
28
  expect(sh).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('iSh, iCmd, iQsh, Unit Tests', () => {
42
41
  });
43
42
  });
44
43
 
45
- describe('iCmd function', () => {
46
- it('accepts command input and returns <cmd> XML output', () => {
44
+ describe('iCmd function', function () {
45
+ it('accepts command input and returns <cmd> XML output', function () {
47
46
  const cmd = iCmd('RTVJOBA USRLIBL(?) SYSLIBL(?)');
48
47
 
49
48
  const expectedXML = '<cmd exec=\'rexx\' error=\'fast\'>RTVJOBA USRLIBL(?) SYSLIBL(?)</cmd>';
@@ -51,7 +50,7 @@ describe('iSh, iCmd, iQsh, Unit Tests', () => {
51
50
  expect(cmd).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('iSh, iCmd, iQsh, Unit Tests', () => {
65
64
  });
66
65
  });
67
66
 
68
- describe('iQsh function', () => {
69
- it('accepts command input and returns <qsh> XML output', () => {
67
+ describe('iQsh function', function () {
68
+ it('accepts command input and returns <qsh> XML output', function () {
70
69
  const qsh = iQsh('RTVJOBA USRLIBL(?) SYSLIBL(?)');
71
70
 
72
71
  const expectedXML = '<qsh error=\'fast\'>RTVJOBA USRLIBL(?) SYSLIBL(?)</qsh>';
@@ -74,7 +73,7 @@ describe('iSh, iCmd, iQsh, Unit Tests', () => {
74
73
  expect(qsh).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,15 @@
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');
22
21
  const sinon = require('sinon');
23
22
  const { iConn, iSh } = require('../../../lib/itoolkit');
24
23
 
25
- describe('iConn Class Unit Tests', () => {
26
- describe('constructor', () => {
27
- it('creates and returns an instance of iConn with idb transport', () => {
24
+ describe('iConn Class Unit Tests', function () {
25
+ describe('constructor', function () {
26
+ it('creates and returns an instance of iConn with idb transport', function () {
28
27
  const database = process.env.TKDB || '*LOCAL';
29
28
  const username = process.env.TKUSER || '';
30
29
  const password = process.env.TKPASS || '';
@@ -42,7 +41,7 @@ describe('iConn Class Unit Tests', () => {
42
41
  expect(connection.connection.verbose).to.equal(false);
43
42
  });
44
43
 
45
- it('creates and returns an instance of iConn with rest transport', () => {
44
+ it('creates and returns an instance of iConn with rest transport', function () {
46
45
  const database = process.env.TKDB || '*LOCAL';
47
46
  const username = process.env.TKUSER || '';
48
47
  const password = process.env.TKPASS || '';
@@ -73,8 +72,8 @@ describe('iConn Class Unit Tests', () => {
73
72
  });
74
73
  });
75
74
 
76
- describe('add', () => {
77
- it('appends to xml service request to the command list using iConn class', () => {
75
+ describe('add', function () {
76
+ it('appends to xml service request to the command list using iConn class', function () {
78
77
  const database = process.env.TKDB || '*LOCAL';
79
78
  const username = process.env.TKUSER || '';
80
79
  const password = process.env.TKPASS || '';
@@ -86,9 +85,8 @@ describe('iConn Class Unit Tests', () => {
86
85
  });
87
86
  });
88
87
 
89
-
90
- describe('debug', () => {
91
- it('turns verbose mode on/off using iConn class', () => {
88
+ describe('debug', function () {
89
+ it('turns verbose mode on/off using iConn class', function () {
92
90
  const database = process.env.TKDB || '*LOCAL';
93
91
  const username = process.env.TKUSER || '';
94
92
  const password = process.env.TKPASS || '';
@@ -101,9 +99,8 @@ describe('iConn Class Unit Tests', () => {
101
99
  });
102
100
  });
103
101
 
104
-
105
- describe('getTransportOptions', () => {
106
- it('returns conn (object) property from iConn instance', () => {
102
+ describe('getTransportOptions', function () {
103
+ it('returns conn (object) property from iConn instance', function () {
107
104
  const database = process.env.TKDB || '*LOCAL';
108
105
  const username = process.env.TKUSER || '';
109
106
  const password = process.env.TKPASS || '';
@@ -120,9 +117,8 @@ describe('iConn Class Unit Tests', () => {
120
117
  });
121
118
  });
122
119
 
123
-
124
- describe('run', () => {
125
- it('(iConn) invokes transport to execute xml input and returns xml output in callback', () => {
120
+ describe('run', function () {
121
+ it('(iConn) invokes transport to execute xml input and returns xml output in callback', function () {
126
122
  const database = process.env.TKDB || '*LOCAL';
127
123
  const username = process.env.TKUSER || '';
128
124
  const password = process.env.TKPASS || '';
@@ -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,22 +37,24 @@ const errno = [
38
37
  ['', '1A'],
39
38
  ];
40
39
 
41
- describe('iPgm Class Unit Tests', () => {
42
- describe('constructor', () => {
43
- it('creates and returns an instance of iPgm with lib and function set', () => {
40
+ describe('iPgm Class Unit Tests', function () {
41
+ describe('constructor', function () {
42
+ it('creates and returns an instance of iPgm with lib and function set', function () {
44
43
  const pgm = new iPgm('QTOCNETSTS');
45
44
  expect(pgm).to.be.instanceOf(iPgm);
46
45
  });
47
46
  });
48
47
 
49
- describe('toXML', () => {
50
- it('returns pgm XML', () => {
51
- const pgm = new iPgm('QTOCNETSTS',
48
+ describe('toXML', function () {
49
+ it('returns pgm XML', function () {
50
+ const pgm = new iPgm(
51
+ 'QTOCNETSTS',
52
52
  {
53
53
  lib: 'QSYS',
54
54
  func: 'QtoRtvTCPA',
55
55
  error: 'on',
56
- });
56
+ },
57
+ );
57
58
 
58
59
  const expectedXML = '<pgm name=\'QTOCNETSTS\' lib=\'QSYS\' func=\'QtoRtvTCPA\' error=\'on\'></pgm>';
59
60
 
@@ -61,14 +62,16 @@ describe('iPgm Class Unit Tests', () => {
61
62
  });
62
63
  });
63
64
 
64
- describe('addParam', () => {
65
- it('appends param to pgm xml', () => {
66
- const pgm = new iPgm('QTOCNETSTS',
65
+ describe('addParam', function () {
66
+ it('appends param to pgm xml', function () {
67
+ const pgm = new iPgm(
68
+ 'QTOCNETSTS',
67
69
  {
68
70
  lib: 'QSYS',
69
71
  func: 'QtoRtvTCPA',
70
72
  error: 'fast',
71
- });
73
+ },
74
+ );
72
75
 
73
76
  pgm.addParam(outBuf, { io: 'out' });
74
77
 
@@ -133,7 +136,7 @@ describe('iPgm Class Unit Tests', () => {
133
136
  expect(pgm.toXML()).to.equal(expectedXML);
134
137
  });
135
138
 
136
- it('regular <parm> contains by=\'val\'', () => {
139
+ it('regular <parm> contains by=\'val\'', function () {
137
140
  const pgm = new iPgm('MYPGM', { lib: 'MYLIB', func: 'MY_PROCEDURE' });
138
141
 
139
142
  pgm.addParam('', '1A', { by: 'val' });
@@ -143,7 +146,7 @@ describe('iPgm Class Unit Tests', () => {
143
146
  expect(lookAtXML).to.match(/<parm .*by='val'.*>/);
144
147
  });
145
148
 
146
- it('data structure <parm> contains by=\'val\'', () => {
149
+ it('data structure <parm> contains by=\'val\'', function () {
147
150
  const pgm = new iPgm('MYPGM', { lib: 'MYLIB', func: 'MY_PROCEDURE' });
148
151
 
149
152
  const params = [
@@ -158,7 +161,7 @@ describe('iPgm Class Unit Tests', () => {
158
161
  expect(lookAtXML).to.match(/<parm .*by='val'.*>/);
159
162
  });
160
163
 
161
- it('regular <parm> contains by=\'val\', with io=\'both\'', () => {
164
+ it('regular <parm> contains by=\'val\', with io=\'both\'', function () {
162
165
  const pgm = new iPgm('MYPGM', { lib: 'MYLIB', func: 'MY_PROCEDURE' });
163
166
 
164
167
  pgm.addParam('', '1A', { by: 'val', io: 'both' });
@@ -169,7 +172,7 @@ describe('iPgm Class Unit Tests', () => {
169
172
  expect(lookAtXML).to.match(/<parm .*io='both'.*>/);
170
173
  });
171
174
 
172
- it('data structure <parm> contains by=\'val\', with io=\'both\'', () => {
175
+ it('data structure <parm> contains by=\'val\', with io=\'both\'', function () {
173
176
  const pgm = new iPgm('MYPGM', { lib: 'MYLIB', func: 'MY_PROCEDURE' });
174
177
 
175
178
  const params = [
@@ -186,15 +189,16 @@ describe('iPgm Class Unit Tests', () => {
186
189
  });
187
190
  });
188
191
 
189
-
190
- describe('addReturn', () => {
191
- it('appends return to pgm xml', () => {
192
- const pgm = new iPgm('QTOCNETSTS',
192
+ describe('addReturn', function () {
193
+ it('appends return to pgm xml', function () {
194
+ const pgm = new iPgm(
195
+ 'QTOCNETSTS',
193
196
  {
194
197
  lib: 'QSYS',
195
198
  func: 'QtoRtvTCPA',
196
199
  error: 'fast',
197
- });
200
+ },
201
+ );
198
202
 
199
203
  pgm.addReturn('0', '20A');
200
204