Skip to content

Commit

Permalink
test: Remove arrow functions from mocha functions (#283)
Browse files Browse the repository at this point in the history
  • Loading branch information
abmusse committed Jun 11, 2020
1 parent 89e67e6 commit 9cb7543
Show file tree
Hide file tree
Showing 27 changed files with 374 additions and 383 deletions.
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ module.exports = {
'prefer-arrow-callback': 'off',

// The following rules cause problems for our existing tests, so they are disabled for now:
'mocha/no-mocha-arrows': 'off',
'mocha/no-skipped-tests': 'off',
'mocha/no-hooks-for-single-case': 'off',
'mocha/no-identical-title': 'off',
Expand Down
16 changes: 8 additions & 8 deletions test/functional/CommandCallFunctional.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ const { CommandCall, Connection } = require('../../lib/itoolkit');
const { config, printConfig } = require('./config');


describe('CommandCall Functional Tests', () => {
before(() => {
describe('CommandCall Functional Tests', function () {
before(function () {
printConfig();
});

describe('CL command tests', () => {
it('calls CL command', (done) => {
describe('CL command tests', function () {
it('calls CL command', function (done) {
const connection = new Connection(config);
connection.add(new CommandCall({ command: 'RTVJOBA USRLIBL(?) SYSLIBL(?)', type: 'cl' }));
connection.run((error, xmlOut) => {
Expand All @@ -41,8 +41,8 @@ describe('CommandCall Functional Tests', () => {
});
});

describe('SH command tests', () => {
it('calls PASE shell command', (done) => {
describe('SH command tests', function () {
it('calls PASE shell command', function (done) {
const connection = new Connection(config);
connection.add(new CommandCall({ command: 'system -i wrksyssts', type: 'sh' }));
connection.run((error, xmlOut) => {
Expand All @@ -58,8 +58,8 @@ describe('CommandCall Functional Tests', () => {
});
});

describe('QSH command tests', () => {
it('calls QSH command', (done) => {
describe('QSH command tests', function () {
it('calls QSH command', function (done) {
const connection = new Connection(config);
connection.add(new CommandCall({ command: 'system wrksyssts', type: 'qsh' }));
connection.run((error, xmlOut) => {
Expand Down
13 changes: 6 additions & 7 deletions test/functional/ProgramCallFunctional.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,19 @@
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


const { expect } = require('chai');
const { parseString } = require('xml2js');
const { ProgramCall, Connection } = require('../../lib/itoolkit');
const { config, printConfig } = require('./config');


describe('ProgramCall Functional Tests', () => {
before(() => {
describe('ProgramCall Functional Tests', function () {
before(function () {
printConfig();
});

describe('Test ProgramCall()', () => {
it('calls QWCRSVAL program checks if it ran successfully', (done) => {
describe('Test ProgramCall()', function () {
it('calls QWCRSVAL program checks if it ran successfully', function (done) {
const connection = new Connection(config);

const program = new ProgramCall('QWCRSVAL', { lib: 'QSYS' });
Expand Down Expand Up @@ -82,10 +81,10 @@ describe('ProgramCall Functional Tests', () => {
});
});

describe.skip('Test ProgramCall()', () => {
describe.skip('Test ProgramCall()', function () {
// ZZSRV6 program requires XMLSERVICE built with tests
// Skip for now, we need to add before hook to check ZZSRV6 is available
it.skip('Should be successful with addReturn arbitrary attribute specified', (done) => {
it.skip('Should be successful with addReturn arbitrary attribute specified', function (done) {
const connection = new Connection(config);

const program = new ProgramCall('ZZSRV6', { lib: 'XMLSERVICE', func: 'ZZVARY4' });
Expand Down
17 changes: 8 additions & 9 deletions test/functional/deprecated/commandsFunctional.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

/* eslint-disable new-cap */


const { expect } = require('chai');
const { parseString } = require('xml2js');
const {
Expand Down Expand Up @@ -45,13 +44,13 @@ if (config.transport === 'rest') {
};
}

describe('iSh, iCmd, iQsh, Functional Tests', () => {
before(() => {
describe('iSh, iCmd, iQsh, Functional Tests', function () {
before(function () {
printConfig();
});

describe('iCmd()', () => {
it('calls CL command', (done) => {
describe('iCmd()', function () {
it('calls CL command', function (done) {
const connection = new iConn(database, username, password, restOptions);
connection.add(iCmd('RTVJOBA USRLIBL(?) SYSLIBL(?)'));
connection.run((xmlOut) => {
Expand All @@ -64,8 +63,8 @@ describe('iSh, iCmd, iQsh, Functional Tests', () => {
});
});

describe('iSh()', () => {
it('calls PASE shell command', (done) => {
describe('iSh()', function () {
it('calls PASE shell command', function (done) {
const connection = new iConn(database, username, password, restOptions);
connection.add(iSh('system -i wrksyssts'));
connection.run((xmlOut) => {
Expand All @@ -80,8 +79,8 @@ describe('iSh, iCmd, iQsh, Functional Tests', () => {
});
});

describe('iQsh()', () => {
it('calls QSH command', (done) => {
describe('iQsh()', function () {
it('calls QSH command', function (done) {
const connection = new iConn(database, username, password, restOptions);
connection.add(iQsh('system wrksyssts'));
connection.run((xmlOut) => {
Expand Down
20 changes: 10 additions & 10 deletions test/functional/deprecated/iDataQueueFunctional.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,26 @@ if (config.transport === 'rest') {

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

describe('iDataQueue Functional Tests', () => {
before('check if data queue exists for tests', (done) => {
describe('iDataQueue Functional Tests', function () {
before('check if data queue exists for tests', function (done) {
printConfig();
checkObjectExists(config, dqName, '*DTAQ', (error) => {
if (error) { throw error; }
done();
});
});

describe('constructor', () => {
it('creates and returns an instance of iDataQueue', () => {
describe('constructor', function () {
it('creates and returns an instance of iDataQueue', function () {
const connection = new iConn(database, config.user, password);

const dq = new iDataQueue(connection);
expect(dq).to.be.instanceOf(iDataQueue);
});
});

describe('sendToDataQueue', () => {
it('sends data to specified DQ', (done) => {
describe('sendToDataQueue', function () {
it('sends data to specified DQ', function (done) {
const connection = new iConn(database, username, password, restOptions);

const dq = new iDataQueue(connection);
Expand All @@ -75,8 +75,8 @@ describe('iDataQueue Functional Tests', () => {
});
});

describe('receiveFromDataQueue', () => {
it('receives data from specfied DQ', (done) => {
describe('receiveFromDataQueue', function () {
it('receives data from specfied DQ', function (done) {
const connection = new iConn(database, username, password, restOptions);

const dq = new iDataQueue(connection);
Expand All @@ -88,8 +88,8 @@ describe('iDataQueue Functional Tests', () => {
});
});

describe('clearDataQueue', () => {
it('clears the specifed DQ', (done) => {
describe('clearDataQueue', function () {
it('clears the specifed DQ', function (done) {
const connection = new iConn(database, username, password, restOptions);

const dq = new iDataQueue(connection);
Expand Down
16 changes: 8 additions & 8 deletions test/functional/deprecated/iNetworkFunctional.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ if (config.transport === 'rest') {
};
}

describe('iNetwork Functional Tests', () => {
before(() => {
describe('iNetwork Functional Tests', function () {
before(function () {
printConfig();
});

describe('constructor', () => {
it('creates and returns an instance of iNetwork', () => {
describe('constructor', function () {
it('creates and returns an instance of iNetwork', function () {
const connection = new iConn(database, config.user, password);

const net = new iNetwork(connection);
Expand All @@ -56,8 +56,8 @@ describe('iNetwork Functional Tests', () => {
});
});

describe('getTCPIPAttr', () => {
it('retrieves TCP/IP Attributes', (done) => {
describe('getTCPIPAttr', function () {
it('retrieves TCP/IP Attributes', function (done) {
const connection = new iConn(database, username, password, restOptions);

const net = new iNetwork(connection);
Expand Down Expand Up @@ -98,8 +98,8 @@ describe('iNetwork Functional Tests', () => {
});
});

describe('getNetInterfaceData', () => {
it('retrieves IPv4 network interface info', (done) => {
describe('getNetInterfaceData', function () {
it('retrieves IPv4 network interface info', function (done) {
const connection = new iConn(database, username, password, restOptions);

const net = new iNetwork(connection);
Expand Down
36 changes: 18 additions & 18 deletions test/functional/deprecated/iObjFunctional.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ if (config.transport === 'rest') {
};
}

describe('iObj Functional Tests', () => {
before(() => {
describe('iObj Functional Tests', function () {
before(function () {
printConfig();
});

describe('constructor', () => {
it('creates and returns an instance of iObj', () => {
describe('constructor', function () {
it('creates and returns an instance of iObj', function () {
const connection = new iConn(database, config.user, password);

const obj = new iObj(connection);
Expand All @@ -56,8 +56,8 @@ describe('iObj Functional Tests', () => {
});
});

describe('retrUsrAuth', () => {
it(`returns uses's authority for an object using ${config.transport} tranport`, (done) => {
describe('retrUsrAuth', function () {
it(`returns uses's authority for an object using ${config.transport} tranport`, function (done) {
const connection = new iConn(database, username, password, restOptions);

const obj = new iObj(connection);
Expand Down Expand Up @@ -100,8 +100,8 @@ describe('iObj Functional Tests', () => {
});
});

describe('rtrCmdInfo', () => {
it('returns command info', (done) => {
describe('rtrCmdInfo', function () {
it('returns command info', function (done) {
const connection = new iConn(database, username, password, restOptions);

const obj = new iObj(connection);
Expand Down Expand Up @@ -152,8 +152,8 @@ describe('iObj Functional Tests', () => {
});
});

describe('retrPgmInfo', () => {
it('returns program info', (done) => {
describe('retrPgmInfo', function () {
it('returns program info', function (done) {
const connection = new iConn(database, username, password, restOptions);

const obj = new iObj(connection);
Expand Down Expand Up @@ -226,8 +226,8 @@ describe('iObj Functional Tests', () => {
});
});

describe('retrSrvPgmInfo', () => {
it('returns service program info', (done) => {
describe('retrSrvPgmInfo', function () {
it('returns service program info', function (done) {
const connection = new iConn(database, username, password, restOptions);

const obj = new iObj(connection);
Expand Down Expand Up @@ -281,8 +281,8 @@ describe('iObj Functional Tests', () => {
});
});

describe('retrUserInfo', () => {
it('returns specified user profile info', (done) => {
describe('retrUserInfo', function () {
it('returns specified user profile info', function (done) {
const connection = new iConn(database, username, password, restOptions);

const obj = new iObj(connection);
Expand All @@ -307,8 +307,8 @@ describe('iObj Functional Tests', () => {
});
});

describe('retrUsrAuthToObj', () => {
it(`retrieves info for users who are authorized to an object using ${config.transport} transpsort`, (done) => {
describe('retrUsrAuthToObj', function () {
it(`retrieves info for users who are authorized to an object using ${config.transport} transpsort`, function (done) {
const connection = new iConn(database, username, password, restOptions);

const obj = new iObj(connection);
Expand All @@ -334,8 +334,8 @@ describe('iObj Functional Tests', () => {
});
});

describe('addToLibraryList', () => {
it('appends lib to user\'s lib list', (done) => {
describe('addToLibraryList', function () {
it('appends lib to user\'s lib list', function (done) {
const connection = new iConn(database, username, password, restOptions);

const obj = new iObj(connection);
Expand Down
12 changes: 6 additions & 6 deletions test/functional/deprecated/iPgmFunctional.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ if (config.transport === 'rest') {
};
}

describe('iPgm Functional Tests', () => {
before(() => {
describe('iPgm Functional Tests', function () {
before(function () {
printConfig();
});

describe('Test iPgm()', () => {
it('calls QWCRSVAL program checks if it ran successfully', (done) => {
describe('Test iPgm()', function () {
it('calls QWCRSVAL program checks if it ran successfully', function (done) {
const connection = new iConn(database, username, password, restOptions);

const program = new iPgm('QWCRSVAL', { lib: 'QSYS' });
Expand Down Expand Up @@ -79,10 +79,10 @@ describe('iPgm Functional Tests', () => {
});
});

describe.skip('Test iPgm()', () => {
describe.skip('Test iPgm()', function () {
// ZZSRV6 program requires XMLSERVICE built with tests
// Skip for now, we need to add before hook to check if ZZSRV6 is available
it.skip('Should be successful with addReturn arbitrary attribute specified using', (done) => {
it.skip('Should be successful with addReturn arbitrary attribute specified using', function (done) {
const connection = new iConn(database, username, password, restOptions);

const program = new iPgm('ZZSRV6', { lib: 'XMLSERVICE', func: 'ZZVARY4' });
Expand Down

0 comments on commit 9cb7543

Please sign in to comment.