Skip to content

Commit fc4f2d1

Browse files
committed
test: Mute deprecation warnings
1 parent b9875c2 commit fc4f2d1

14 files changed

+381
-1
lines changed

test/functional/deprecated/commandsFunctional.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ if (config.transport === 'rest') {
4747
describe('iSh, iCmd, iQsh, Functional Tests', function () {
4848
before(function () {
4949
printConfig();
50+
process.on('deprecation', function () {
51+
// capture depreacation warnings but no-op
52+
// test/unit/commandsUnit.js already ensures deprecations are emited
53+
});
54+
});
55+
56+
after(function () {
57+
process.removeAllListeners('deprecation', function () {
58+
// no-op
59+
});
5060
});
5161

5262
describe('iCmd()', function () {

test/functional/deprecated/iDataQueueFunctional.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,39 @@ if (config.transport === 'rest') {
4444

4545
const lib = 'NODETKTEST'; const dqName = 'TESTQ';
4646

47+
let deprecation = null;
48+
function deprecationHandler(dep) {
49+
deprecation = dep;
50+
}
51+
52+
function getDeprecation() {
53+
const temp = deprecation;
54+
deprecation = null;
55+
return temp;
56+
}
57+
4758
describe('iDataQueue Functional Tests', function () {
4859
before('check if data queue exists for tests', function (done) {
4960
printConfig();
61+
process.on('deprecation', deprecationHandler);
5062
checkObjectExists(config, dqName, '*DTAQ', (error) => {
5163
if (error) { throw error; }
5264
done();
5365
});
5466
});
5567

68+
after(function () {
69+
process.removeAllListeners('deprecation', deprecationHandler);
70+
});
71+
5672
describe('constructor', function () {
5773
it('creates and returns an instance of iDataQueue', function () {
5874
const connection = new iConn(database, config.user, password);
5975

6076
const dq = new iDataQueue(connection);
6177
expect(dq).to.be.instanceOf(iDataQueue);
78+
expect(getDeprecation().message).to
79+
.equal("As of v1.0, class 'iDataQueue' is deprecated and will be removed at a later time.");
6280
});
6381
});
6482

@@ -70,6 +88,8 @@ describe('iDataQueue Functional Tests', function () {
7088

7189
dq.sendToDataQueue(dqName, lib, 'Hello from DQ!', (output) => {
7290
expect(output).to.equal(true);
91+
expect(getDeprecation().message).to
92+
.equal("As of v1.0, 'iDataQueue.sendToDataQueue()' is deprecated and will be removed at a later time.");
7393
done();
7494
});
7595
});
@@ -83,6 +103,8 @@ describe('iDataQueue Functional Tests', function () {
83103

84104
dq.receiveFromDataQueue(dqName, lib, 100, (output) => {
85105
expect(output).to.be.a('string').and.to.equal('Hello from DQ!');
106+
expect(getDeprecation().message).to
107+
.equal("As of v1.0, 'iDataQueue.receiveFromDataQueue()' is deprecated and will be removed at a later time.");
86108
done();
87109
});
88110
});
@@ -96,6 +118,8 @@ describe('iDataQueue Functional Tests', function () {
96118

97119
dq.clearDataQueue(dqName, lib, (output) => {
98120
expect(output).to.equal(true);
121+
expect(getDeprecation().message).to
122+
.equal("As of v1.0, 'iDataQueue.clearDataQueue()' is deprecated and will be removed at a later time.");
99123
done();
100124
});
101125
});

test/functional/deprecated/iNetworkFunctional.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,25 @@ if (config.transport === 'rest') {
4141
};
4242
}
4343

44+
let deprecation = null;
45+
function deprecationHandler(dep) {
46+
deprecation = dep;
47+
}
48+
49+
function getDeprecation() {
50+
const temp = deprecation;
51+
deprecation = null;
52+
return temp;
53+
}
54+
4455
describe('iNetwork Functional Tests', function () {
4556
before(function () {
4657
printConfig();
58+
process.on('deprecation', deprecationHandler);
59+
});
60+
61+
after(function () {
62+
process.removeAllListeners('deprecation', deprecationHandler);
4763
});
4864

4965
describe('constructor', function () {
@@ -53,6 +69,8 @@ describe('iNetwork Functional Tests', function () {
5369
const net = new iNetwork(connection);
5470

5571
expect(net).to.be.instanceOf(iNetwork);
72+
expect(getDeprecation().message).to
73+
.equal("As of v1.0, class 'iNetwork' is deprecated and will be removed at a later time.");
5674
});
5775
});
5876

@@ -63,6 +81,8 @@ describe('iNetwork Functional Tests', function () {
6381
const net = new iNetwork(connection);
6482

6583
net.getTCPIPAttr((output) => {
84+
expect(getDeprecation().message).to
85+
.equal("As of v1.0, 'iNetwork.getTCPIPAttr()' is deprecated and will be removed at a later time.");
6686
expect(output).to.be.an('Object');
6787
expect(output).to.have.a.property('TCP/IPv4_stack_status');
6888
expect(output).to.have.a.property('How_long_active');
@@ -105,6 +125,8 @@ describe('iNetwork Functional Tests', function () {
105125
const net = new iNetwork(connection);
106126

107127
net.getNetInterfaceData('127.0.0.1', (output) => {
128+
expect(getDeprecation().message).to
129+
.equal("As of v1.0, 'iNetwork.getNetInterfaceData()' is deprecated and will be removed at a later time.");
108130
expect(output).to.be.an('Object');
109131
expect(output).to.have.a.property('Internet_address');
110132
expect(output).to.have.a.property('Internet_address_binary');

test/functional/deprecated/iObjFunctional.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,25 @@ if (config.transport === 'rest') {
4141
};
4242
}
4343

44+
let deprecation = null;
45+
function deprecationHandler(dep) {
46+
deprecation = dep;
47+
}
48+
49+
function getDeprecation() {
50+
const temp = deprecation;
51+
deprecation = null;
52+
return temp;
53+
}
54+
4455
describe('iObj Functional Tests', function () {
4556
before(function () {
4657
printConfig();
58+
process.on('deprecation', deprecationHandler);
59+
});
60+
61+
after(function () {
62+
process.removeAllListeners('deprecation', deprecationHandler);
4763
});
4864

4965
describe('constructor', function () {
@@ -53,6 +69,8 @@ describe('iObj Functional Tests', function () {
5369
const obj = new iObj(connection);
5470

5571
expect(obj).to.be.instanceOf(iObj);
72+
expect(getDeprecation().message).to
73+
.equal("As of v1.0, class 'iObj' is deprecated and will be removed at a later time.");
5674
});
5775
});
5876

@@ -63,6 +81,8 @@ describe('iObj Functional Tests', function () {
6381
const obj = new iObj(connection);
6482

6583
obj.retrUsrAuth('*PUBLIC', '*PGM', 'XMLCGI', 'QXMLSERV', (output) => {
84+
expect(getDeprecation().message).to
85+
.equal("As of v1.0, 'iObj.retrUsrAuth()' is deprecated and will be removed at a later time.");
6686
expect(output).to.be.an('Object');
6787
expect(output).to.have.a.property('Object_authority_/_Data_authority');
6888
expect(output).to.have.a.property('Authorization_list_management');
@@ -107,6 +127,8 @@ describe('iObj Functional Tests', function () {
107127
const obj = new iObj(connection);
108128

109129
obj.retrCmdInfo('CRTLIB', '*LIBL', (output) => {
130+
expect(getDeprecation().message).to
131+
.equal("As of v1.0, 'iObj.retrCmdInfo()' is deprecated and will be removed at a later time.");
110132
expect(output).to.be.an('Object');
111133
expect(output).to.have.a.property('Command_name');
112134
expect(output).to.have.a.property('Command_library_name');
@@ -159,6 +181,8 @@ describe('iObj Functional Tests', function () {
159181
const obj = new iObj(connection);
160182

161183
obj.retrPgmInfo('XMLCGI', 'QXMLSERV', (output) => {
184+
expect(getDeprecation().message).to
185+
.equal("As of v1.0, 'iObj.retrPgmInfo()' is deprecated and will be removed at a later time.");
162186
expect(output).to.be.an('Object');
163187
expect(output).to.have.a.property('Program_name');
164188
expect(output).to.have.a.property('Program_library_name');
@@ -233,6 +257,8 @@ describe('iObj Functional Tests', function () {
233257
const obj = new iObj(connection);
234258

235259
obj.retrSrvPgmInfo('QZSRVSSL', 'QHTTPSVR', (output) => {
260+
expect(getDeprecation().message).to
261+
.equal("As of v1.0, 'iObj.retrSrvPgmInfo()' is deprecated and will be removed at a later time.");
236262
expect(output).to.be.an('Object');
237263
expect(output).to.have.a.property('Service_program_name');
238264
expect(output).to.have.a.property('Service_program_name');
@@ -288,6 +314,8 @@ describe('iObj Functional Tests', function () {
288314
const obj = new iObj(connection);
289315

290316
obj.retrUserInfo('QSYS', (output) => {
317+
expect(getDeprecation().message).to
318+
.equal("As of v1.0, 'iObj.retrUserInfo()' is deprecated and will be removed at a later time.");
291319
expect(output).to.be.an('Object');
292320
expect(output).to.have.a.property('User_profile_name');
293321
expect(output).to.have.a.property('Previous_sign-on_date_and_time');
@@ -314,6 +342,8 @@ describe('iObj Functional Tests', function () {
314342
const obj = new iObj(connection);
315343

316344
obj.retrUserAuthToObj('/home', (output) => {
345+
expect(getDeprecation().message).to
346+
.equal("As of v1.0, 'iObj.retrUserAuthToObj()' is deprecated and will be removed at a later time.");
317347
expect(output).to.be.an('Object');
318348
expect(output).to.have.a.property('Profile_name');
319349
expect(output).to.have.a.property('User_or_group_indicator');
@@ -341,6 +371,8 @@ describe('iObj Functional Tests', function () {
341371
const obj = new iObj(connection);
342372

343373
obj.addToLibraryList('QHTTPSVR', (output) => {
374+
expect(getDeprecation().message).to
375+
.equal("As of v1.0, 'iObj.addToLibraryList()' is deprecated and will be removed at a later time.");
344376
expect(output).to.be.a('boolean').and.to.equal(true);
345377
done();
346378
});

test/functional/deprecated/iPgmFunctional.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ if (config.transport === 'rest') {
4545
describe('iPgm Functional Tests', function () {
4646
before(function () {
4747
printConfig();
48+
process.on('deprecation', function () {
49+
// capture depreacation warnings but no-op
50+
// test/unit/iPgmUnit.js already ensures deprecations are emited
51+
});
52+
});
53+
54+
after(function () {
55+
process.removeAllListeners('deprecation', function () {
56+
// no-op
57+
});
4858
});
4959

5060
describe('Test iPgm()', function () {

test/functional/deprecated/iProdFunctional.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,25 @@ if (config.transport === 'rest') {
4141
};
4242
}
4343

44+
let deprecation = null;
45+
function deprecationHandler(dep) {
46+
deprecation = dep;
47+
}
48+
49+
function getDeprecation() {
50+
const temp = deprecation;
51+
deprecation = null;
52+
return temp;
53+
}
54+
4455
describe('iProd Functional Tests', function () {
4556
before(function () {
4657
printConfig();
58+
process.on('deprecation', deprecationHandler);
59+
});
60+
61+
after(function () {
62+
process.removeAllListeners('deprecation', deprecationHandler);
4763
});
4864

4965
describe('constructor', function () {
@@ -53,6 +69,8 @@ describe('iProd Functional Tests', function () {
5369
const prod = new iProd(connection);
5470

5571
expect(prod).to.be.instanceOf(iProd);
72+
expect(getDeprecation().message).to
73+
.equal("As of v1.0, class 'iProd' is deprecated and will be removed at a later time.");
5674
});
5775
});
5876

@@ -63,6 +81,8 @@ describe('iProd Functional Tests', function () {
6381
const prod = new iProd(connection);
6482

6583
prod.getPTFInfo('SI67726', (ptf) => {
84+
expect(getDeprecation().message).to
85+
.equal("As of v1.0, 'iProd.getPTFInfo()' is deprecated and will be removed at a later time");
6686
expect(ptf).to.be.an('Object');
6787
expect(ptf).to.have.a.property('Product_ID');
6888
expect(ptf).to.have.a.property('PTF_ID');
@@ -105,6 +125,8 @@ describe('iProd Functional Tests', function () {
105125
const prod = new iProd(connection);
106126

107127
prod.getProductInfo('5770DG1', (product) => {
128+
expect(getDeprecation().message).to
129+
.equal("As of v1.0, 'iProd.getProductInfo()' is deprecated and will be removed at a later time");
108130
expect(product).to.be.an('Object');
109131
expect(product).to.have.a.property('Product_ID');
110132
expect(product).to.have.a.property('Release_level');
@@ -136,6 +158,8 @@ describe('iProd Functional Tests', function () {
136158
const prod = new iProd(connection);
137159

138160
prod.getInstalledProducts((products) => {
161+
expect(getDeprecation().message).to
162+
.equal("As of v1.0, 'iProd.getInstalledProducts()' is deprecated and will be removed at a later time");
139163
expect(products).to.be.an('Array');
140164
expect(products.length).to.be.greaterThan(0);
141165

test/functional/deprecated/iSqlFunctional.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ if (config.transport === 'rest') {
4545
describe('iSql Functional Tests', function () {
4646
before(function () {
4747
printConfig();
48+
process.on('deprecation', function () {
49+
// capture depreacation warnings but no-op
50+
// test/unit/iSqlUnit.js already ensures deprecations are emited
51+
});
52+
});
53+
54+
after(function () {
55+
process.removeAllListeners('deprecation', function () {
56+
// no-op
57+
});
4858
});
4959

5060
describe('prepare & execute', function () {

0 commit comments

Comments
 (0)