diff --git a/test/integration/setup.js b/test/integration/setup.js index 9b6f833a3..883ebeeeb 100644 --- a/test/integration/setup.js +++ b/test/integration/setup.js @@ -97,8 +97,7 @@ after(async () => { let mustReinitAfter; beforeEach(() => { - // eslint-disable-next-line keyword-spacing - if(mustReinitAfter) throw new Error(`Failed to reinitalize after previous test: '${mustReinitAfter}'. You may need to increase your mocha timeout.`); + if (mustReinitAfter) throw new Error(`Failed to reinitalize after previous test: '${mustReinitAfter}'. You may need to increase your mocha timeout.`); s3.resetMock(); }); afterEach(async function() { diff --git a/test/unit/data/attachments.js b/test/unit/data/attachments.js index 56f527dfb..c0cb54876 100644 --- a/test/unit/data/attachments.js +++ b/test/unit/data/attachments.js @@ -13,8 +13,7 @@ describe('.zip attachments streaming', () => { { row: { instanceId: 'subtwo', name: 'thirdfile.ext', content: 'this is my third file' } } ])); zipStreamToFiles(zipStreamFromParts(streamAttachments(inStream)), (err, result) => { - // eslint-disable-next-line keyword-spacing - if(err) return done(err); + if (err) return done(err); result.filenames.should.eql([ 'media/firstfile.ext', @@ -37,8 +36,7 @@ describe('.zip attachments streaming', () => { { row: { instanceId: 'subone', name: './.secondfile.ext', content: 'this is my duplicate second file' } }, ])); zipStreamToFiles(zipStreamFromParts(streamAttachments(inStream)), (err, result) => { - // eslint-disable-next-line keyword-spacing - if(err) return done(err); + if (err) return done(err); result.filenames.should.eql([ 'media/firstfile.ext', @@ -55,8 +53,7 @@ describe('.zip attachments streaming', () => { { row: { instanceId: 'subone', name: 'firstfile.ext.enc', content: 'this is my first file' } } ])); zipStreamToFiles(zipStreamFromParts(streamAttachments(inStream)), (err, result) => { - // eslint-disable-next-line keyword-spacing - if(err) return done(err); + if (err) return done(err); result.filenames.should.eql([ 'media/firstfile.ext.enc' ]); done(); @@ -68,8 +65,7 @@ describe('.zip attachments streaming', () => { { row: { instanceId: 'subone', name: 'firstfile.ext.enc', content: 'this is my first file' } } ])); zipStreamToFiles(zipStreamFromParts(streamAttachments(inStream, () => {})), (err, result) => { - // eslint-disable-next-line keyword-spacing - if(err) return done(err); + if (err) return done(err); result.filenames.should.eql([ 'media/firstfile.ext' ]); done(); diff --git a/test/unit/data/briefcase.js b/test/unit/data/briefcase.js index 8f719826c..7c9bcbc7e 100644 --- a/test/unit/data/briefcase.js +++ b/test/unit/data/briefcase.js @@ -59,8 +59,7 @@ describe('.csv.zip briefcase output @slow', () => { ]); callAndParse(inStream, formXml, 'mytestform', (err, result) => { - // eslint-disable-next-line keyword-spacing - if(err) return done(err); + if (err) return done(err); result.filenames.should.eql([ 'mytestform.csv' ]); result['mytestform.csv'].should.equal( @@ -113,8 +112,7 @@ describe('.csv.zip briefcase output @slow', () => { ]); callAndParse(inStream, formXml, 'mytestform', (err, result) => { - // eslint-disable-next-line keyword-spacing - if(err) return done(err); + if (err) return done(err); result.filenames.should.eql([ 'mytestform.csv' ]); result['mytestform.csv'].should.equal( @@ -154,8 +152,7 @@ describe('.csv.zip briefcase output @slow', () => { ]); callAndParse(inStream, formXml, 'mytestform', (err, result) => { - // eslint-disable-next-line keyword-spacing - if(err) return done(err); + if (err) return done(err); result.filenames.should.eql([ 'mytestform.csv' ]); result['mytestform.csv'].should.equal( @@ -194,8 +191,7 @@ describe('.csv.zip briefcase output @slow', () => { ]); callAndParse(inStream, formXml, 'mytestform', (err, result) => { - // eslint-disable-next-line keyword-spacing - if(err) return done(err); + if (err) return done(err); result.filenames.should.eql([ 'mytestform.csv' ]); result['mytestform.csv'].should.equal( @@ -232,8 +228,7 @@ describe('.csv.zip briefcase output @slow', () => { ]); callAndParse(inStream, formXml, 'mytestform', (err, result) => { - // eslint-disable-next-line keyword-spacing - if(err) return done(err); + if (err) return done(err); result.filenames.should.eql([ 'mytestform.csv' ]); result['mytestform.csv'].should.equal( @@ -269,8 +264,7 @@ describe('.csv.zip briefcase output @slow', () => { const inStream = streamTest.fromObjects([ data ]); callAndParse(inStream, formXml, 'mytestform', (err, result) => { - // eslint-disable-next-line keyword-spacing - if(err) return done(err); + if (err) return done(err); result.filenames.should.eql([ 'mytestform.csv' ]); result['mytestform.csv'].should.equal( @@ -308,8 +302,7 @@ describe('.csv.zip briefcase output @slow', () => { const inStream = streamTest.fromObjects([ one, two ]); callAndParse(inStream, formXml, 'mytestform', (err, result) => { - // eslint-disable-next-line keyword-spacing - if(err) return done(err); + if (err) return done(err); result.filenames.should.eql([ 'mytestform.csv' ]); result['mytestform.csv'].should.equal( @@ -346,8 +339,7 @@ describe('.csv.zip briefcase output @slow', () => { ]); callAndParse(inStream, formXml, 'mytestform', (err, result) => { - // eslint-disable-next-line keyword-spacing - if(err) return done(err); + if (err) return done(err); result.filenames.should.eql([ 'mytestform.csv' ]); result['mytestform.csv'].should.equal( @@ -385,8 +377,7 @@ describe('.csv.zip briefcase output @slow', () => { ]); callAndParse(inStream, formXml, 'mytestform', (err, result) => { - // eslint-disable-next-line keyword-spacing - if(err) return done(err); + if (err) return done(err); result.filenames.should.eql([ 'mytestform.csv' ]); result['mytestform.csv'].should.equal( @@ -407,8 +398,7 @@ describe('.csv.zip briefcase output @slow', () => { fieldsFor(testData.forms.selectMultiple).then((fields) => { zipStreamToFiles(zipStreamFromParts(streamBriefcaseCsvs(inStream, fields, 'selectMultiple', { '/q1': [ 'x', 'y', 'z' ], '/g1/q2': [ 'm', 'n' ] })), (err, result) => { - // eslint-disable-next-line keyword-spacing - if(err) return done(err); + if (err) return done(err); result.filenames.should.eql([ 'selectMultiple.csv' ]); result['selectMultiple.csv'].should.equal( @@ -458,8 +448,7 @@ describe('.csv.zip briefcase output @slow', () => { ]); callAndParse(inStream, formXml, 'structuredform', (err, result) => { - // eslint-disable-next-line keyword-spacing - if(err) return done(err); + if (err) return done(err); result.filenames.should.eql([ 'structuredform.csv' ]); result['structuredform.csv'].should.equal( @@ -510,8 +499,7 @@ describe('.csv.zip briefcase output @slow', () => { fieldsFor(formXml).then((fields) => { zipStreamToFiles(zipStreamFromParts(streamBriefcaseCsvs(inStream, fields, 'structuredform', undefined, undefined, false, { groupPaths: false })), (err, result) => { - // eslint-disable-next-line keyword-spacing - if(err) return done(err); + if (err) return done(err); result.filenames.should.eql([ 'structuredform.csv' ]); result['structuredform.csv'].should.equal( @@ -533,8 +521,7 @@ describe('.csv.zip briefcase output @slow', () => { fieldsFor(testData.forms.selectMultiple).then((fields) => { zipStreamToFiles(zipStreamFromParts(streamBriefcaseCsvs(inStream, fields, 'selectMultiple', { '/q1': [ 'x', 'y', 'z' ], '/g1/q2': [ 'm', 'n' ] }, undefined, false, { groupPaths: false })), (err, result) => { - // eslint-disable-next-line keyword-spacing - if(err) return done(err); + if (err) return done(err); result.filenames.should.eql([ 'selectMultiple.csv' ]); result['selectMultiple.csv'].should.equal( @@ -603,8 +590,7 @@ describe('.csv.zip briefcase output @slow', () => { ]); callAndParse(inStream, formXml, 'singlerepeat', (err, result) => { - // eslint-disable-next-line keyword-spacing - if(err) return done(err); + if (err) return done(err); result.filenames.should.containDeep([ 'singlerepeat.csv', 'singlerepeat-child.csv' ]); result['singlerepeat.csv'].should.equal( @@ -668,8 +654,7 @@ Candace,2,three,three/children/child[1] (new Array(127)).fill(null).map(() => instance(uuid(), `${uuid()}${uuid()}${uuid()}`))); // eslint-disable-line function-paren-newline callAndParse(inStream, formXml, 'singlerepeat', (err, result) => { - // eslint-disable-next-line keyword-spacing - if(err) return done(err); + if (err) return done(err); result.filenames.should.containDeep([ 'singlerepeat.csv', 'singlerepeat-child.csv' ]); result['singlerepeat.csv'].split('\n').length.should.equal(129); @@ -746,8 +731,7 @@ Candace,2,three,three/children/child[1] ]); callAndParse(inStream, formXml, 'multirepeat', (err, result) => { - // eslint-disable-next-line keyword-spacing - if(err) return done(err); + if (err) return done(err); result.filenames.should.containDeep([ 'multirepeat.csv', 'multirepeat-child.csv', 'multirepeat-toy.csv' ]); result['multirepeat.csv'].should.equal( @@ -809,8 +793,7 @@ Pod racer,three/children/child[1],three/children/child[1]/toy[3] ]); callAndParse(inStream, formXml, 'pathprefix', (err, result) => { - // eslint-disable-next-line keyword-spacing - if(err) return done(err); + if (err) return done(err); result.filenames.should.containDeep([ 'pathprefix.csv', 'pathprefix-children.csv' ]); result['pathprefix.csv'].should.equal( @@ -901,8 +884,7 @@ Chelsea,one,one/children[2] }]); callAndParse(inStream, formXml, 'all-data-types', (err, result) => { - // eslint-disable-next-line keyword-spacing - if(err) return done(err); + if (err) return done(err); result.filenames.should.containDeep([ 'all-data-types.csv' ]); result['all-data-types.csv'].should.equal( @@ -1031,8 +1013,7 @@ Chelsea,one,one/children[2] }]); callAndParse(inStream, formXml, 'nested-repeats', (err, result) => { - // eslint-disable-next-line keyword-spacing - if(err) return done(err); + if (err) return done(err); result.filenames.should.containDeep([ 'nested-repeats.csv', 'nested-repeats-g1.csv', 'nested-repeats-g2.csv', 'nested-repeats-g3.csv' ]); result['nested-repeats.csv'].should.equal( @@ -1120,8 +1101,7 @@ some text 3.1.4,uuid:0a1b861f-a5fd-4f49-846a-78dcf06cfc1b/g1[3]/g2[1],uuid:0a1b8 ]); callAndParse(inStream, formXml, 'ambiguous', (err, result) => { - // eslint-disable-next-line keyword-spacing - if(err) return done(err); + if (err) return done(err); result.filenames.should.containDeep([ 'ambiguous.csv', 'ambiguous-entry~1.csv', 'ambiguous-entry~2.csv' ]); result['ambiguous.csv'].should.equal( diff --git a/test/unit/util/zip.js b/test/unit/util/zip.js index f60e60271..d1e1932e2 100644 --- a/test/unit/util/zip.js +++ b/test/unit/util/zip.js @@ -12,8 +12,7 @@ describe('zipPart streamer', () => { let closed = false; zipStreamToFiles(zipStreamFromParts(part), (err) => { - // eslint-disable-next-line keyword-spacing - if(err) return done(err); + if (err) return done(err); closed = true; done(); @@ -96,8 +95,7 @@ describe('zipPart streamer', () => { const part2 = zipPart(); zipStreamToFiles(zipStreamFromParts(part1, part2), (err, result) => { - // eslint-disable-next-line keyword-spacing - if(err) return done(err); + if (err) return done(err); result.filenames.should.containDeep([ 'x/test1.file', @@ -128,8 +126,7 @@ describe('zipPart streamer', () => { const part2 = zipPart(); zipStreamToFiles(zipStreamFromParts(part1, part2), (err, result) => { - // eslint-disable-next-line keyword-spacing - if(err) return done(err); + if (err) return done(err); result.filenames.should.containDeep([ 'test1.file', 'test2.file' ]); result['test1.file'].should.equal('test static'); diff --git a/test/util/zip.js b/test/util/zip.js index c0cb48964..107e2f82e 100644 --- a/test/util/zip.js +++ b/test/util/zip.js @@ -28,13 +28,11 @@ const processZipFile = (zipfile, callback) => { result.filenames.push(entry.fileName); // eslint-disable-next-line no-shadow zipfile.openReadStream(entry, (err, resultStream) => { - // eslint-disable-next-line keyword-spacing - if(err) return callback(err); + if (err) return callback(err); // eslint-disable-next-line no-shadow resultStream.pipe(streamTest.toText((err, contents) => { - // eslint-disable-next-line keyword-spacing - if(err) return callback(err); + if (err) return callback(err); result[entry.fileName] = contents; completed += 1; @@ -51,8 +49,7 @@ const processZipFile = (zipfile, callback) => { const zipStreamToFiles = (zipStream, callback) => { tmp.file((err, tmpfile) => { - // eslint-disable-next-line keyword-spacing - if(err) return callback(err); + if (err) return callback(err); const writeStream = createWriteStream(tmpfile); zipStream.pipe(writeStream);