From f937693a9b38ccfbdd289d594d6511ce38bd0311 Mon Sep 17 00:00:00 2001 From: Abdirahim Musse <33973272+abmusse@users.noreply.github.com> Date: Mon, 13 Jul 2020 12:07:00 -0500 Subject: [PATCH] test: Fix mocha/no-hooks-for-single-case eslint issue --- .eslintrc.js | 1 - test/functional/deprecated/iWorkFunctional.js | 27 +++++++-------- test/functional/iWorkFunctional.js | 33 +++++++++---------- 3 files changed, 27 insertions(+), 34 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 90a843ec..36997421 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -31,7 +31,6 @@ module.exports = { // The following rules cause problems for our existing tests, so they are disabled for now: 'mocha/no-skipped-tests': 'off', - 'mocha/no-hooks-for-single-case': 'off', }, }, ], diff --git a/test/functional/deprecated/iWorkFunctional.js b/test/functional/deprecated/iWorkFunctional.js index 816f9691..9e767c96 100644 --- a/test/functional/deprecated/iWorkFunctional.js +++ b/test/functional/deprecated/iWorkFunctional.js @@ -210,25 +210,22 @@ describe('iWork Functional Tests', function () { }); describe('getDataArea', function () { - before('init lib, data area, and add data', function (done) { + it('returns contents of a data area', function (done) { checkObjectExists(config, 'TESTDA', '*DTAARA', (error) => { if (error) { throw error; } - done(); - }); - }); - it('returns contents of a data area', function (done) { - const connection = new iConn(database, username, password, restOptions); + const connection = new iConn(database, username, password, restOptions); - const work = new iWork(connection); + const work = new iWork(connection); - work.getDataArea('NODETKTEST', 'TESTDA', 20, (output) => { - expect(output).to.be.an('Object'); - expect(output).to.have.a.property('Type_of_value_returned'); - expect(output).to.have.a.property('Library_name'); - expect(output).to.have.a.property('Length_of_value_returned'); - expect(output).to.have.a.property('Number_of_decimal_positions'); - expect(output).to.have.a.property('Value'); - done(); + work.getDataArea('NODETKTEST', 'TESTDA', 20, (output) => { + expect(output).to.be.an('Object'); + expect(output).to.have.a.property('Type_of_value_returned'); + expect(output).to.have.a.property('Library_name'); + expect(output).to.have.a.property('Length_of_value_returned'); + expect(output).to.have.a.property('Number_of_decimal_positions'); + expect(output).to.have.a.property('Value'); + done(); + }); }); }); }); diff --git a/test/functional/iWorkFunctional.js b/test/functional/iWorkFunctional.js index 52b1d755..71214f9b 100644 --- a/test/functional/iWorkFunctional.js +++ b/test/functional/iWorkFunctional.js @@ -192,26 +192,23 @@ describe('iWork Functional Tests', function () { }); describe('getDataArea', function () { - before('check if data area exists for tests', function (done) { + it('returns contents of a data area', function (done) { checkObjectExists(config, 'TESTDA', '*DTAARA', (error) => { if (error) { throw error; } - done(); - }); - }); - it('returns contents of a data area', function (done) { - const connection = new Connection(config); - - const work = new iWork(connection); - - work.getDataArea('NODETKTEST', 'TESTDA', 20, (error, output) => { - expect(error).to.equal(null); - expect(output).to.be.an('Object'); - expect(output).to.have.a.property('Type_of_value_returned'); - expect(output).to.have.a.property('Library_name'); - expect(output).to.have.a.property('Length_of_value_returned'); - expect(output).to.have.a.property('Number_of_decimal_positions'); - expect(output).to.have.a.property('Value'); - done(); + const connection = new Connection(config); + + const work = new iWork(connection); + + work.getDataArea('NODETKTEST', 'TESTDA', 20, (error2, output) => { + expect(error2).to.equal(null); + expect(output).to.be.an('Object'); + expect(output).to.have.a.property('Type_of_value_returned'); + expect(output).to.have.a.property('Library_name'); + expect(output).to.have.a.property('Length_of_value_returned'); + expect(output).to.have.a.property('Number_of_decimal_positions'); + expect(output).to.have.a.property('Value'); + done(); + }); }); }); });