From 9090ebab467f6119b2919ace6182c4ca54c258bb Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Wed, 14 Jun 2023 18:56:41 -0700 Subject: [PATCH] Adapt integration suite to new elasticsearch package - On success, elasticsearch errors are now *null* rather than *undefined*, which broke some tests. Now we just check that `err` is falsy rather than strictly equal to `undefined`. - Payload moved from res to res.body - `statusCode` moved from top level callback arg to `res.statuCode` - normalized function formatting for tests to `(err, { body })` there were a few different styles/indentations. --- integration/address_matching.js | 62 ++++++++-------- integration/admin_abbreviations.js | 72 +++++++++---------- integration/admin_matching.js | 18 ++--- integration/analyzer_peliasPhrase.js | 14 ++-- .../autocomplete_abbreviated_street_names.js | 18 ++--- ...ocomplete_directional_synonym_expansion.js | 36 +++++----- .../autocomplete_street_synonym_expansion.js | 36 +++++----- integration/bounding_box.js | 6 +- integration/dynamic_templates.js | 17 +++-- integration/run.js | 6 +- .../source_layer_sourceid_filtering.js | 28 ++++---- integration/validate.js | 4 +- 12 files changed, 158 insertions(+), 159 deletions(-) diff --git a/integration/address_matching.js b/integration/address_matching.js index 4ea5e23d..59d508e6 100644 --- a/integration/address_matching.js +++ b/integration/address_matching.js @@ -68,9 +68,9 @@ module.exports.tests.functional = function(test, common){ body: { query: { bool: { must: [ { match: { 'address_parts.number': 30 } } ]}}} - }, function( err, res ){ - t.equal( err, undefined ); - t.equal( getTotalHits(res.hits), 1, 'match street number' ); + }, (err, { body }) => { + t.false(err); + t.equal( getTotalHits(body.hits), 1, 'match street number' ); done(); }); }); @@ -82,9 +82,9 @@ module.exports.tests.functional = function(test, common){ body: { query: { bool: { must: [ { match_phrase: { 'address_parts.street': 'west 26th street' } } ]}}} - }, function( err, res ){ - t.equal( err, undefined ); - t.equal( getTotalHits(res.hits), 2, 'match street name' ); + }, (err, { body }) => { + t.false(err); + t.equal( getTotalHits(body.hits), 2, 'match street name' ); done(); }); }); @@ -96,9 +96,9 @@ module.exports.tests.functional = function(test, common){ body: { query: { bool: { must: [ { match_phrase: { 'address_parts.street': 'W 26th ST' } } ]}}} - }, function( err, res ){ - t.equal( err, undefined ); - t.equal( getTotalHits(res.hits), 2, 'match street name - abbr' ); + }, (err, { body }) => { + t.false(err); + t.equal( getTotalHits(body.hits), 2, 'match street name - abbr' ); done(); }); }); @@ -110,9 +110,9 @@ module.exports.tests.functional = function(test, common){ body: { query: { bool: { must: [ { match: { 'address_parts.zip': '10010' } } ]}}} - }, function( err, res ){ - t.equal( err, undefined ); - t.equal( getTotalHits(res.hits), 3, 'match zip - numeric' ); + }, (err, { body }) => { + t.false(err); + t.equal( getTotalHits(body.hits), 3, 'match zip - numeric' ); done(); }); }); @@ -124,9 +124,9 @@ module.exports.tests.functional = function(test, common){ body: { query: { bool: { must: [ { match: { 'address_parts.zip': 'e24dn' } } ]}}} - }, function( err, res ){ - t.equal( err, undefined ); - t.equal( getTotalHits(res.hits), 1, 'match zip - string' ); + }, (err, { body }) => { + t.false(err); + t.equal( getTotalHits(body.hits), 1, 'match zip - string' ); done(); }); }); @@ -138,9 +138,9 @@ module.exports.tests.functional = function(test, common){ body: { query: { bool: { must: [ { match: { 'address_parts.zip': '100-10' } } ]}}} - }, function( err, res ){ - t.equal( err, undefined ); - t.equal( getTotalHits(res.hits), 3, 'match zip - numeric - punct' ); + }, (err, { body }) => { + t.false(err); + t.equal( getTotalHits(body.hits), 3, 'match zip - numeric - punct' ); done(); }); }); @@ -152,9 +152,9 @@ module.exports.tests.functional = function(test, common){ body: { query: { bool: { must: [ { match: { 'address_parts.zip': '10 0 10' } } ]}}} - }, function( err, res ){ - t.equal( err, undefined ); - t.equal( getTotalHits(res.hits), 3, 'match zip - numeric - whitespace' ); + }, (err, { body }) => { + t.false(err); + t.equal( getTotalHits(body.hits), 3, 'match zip - numeric - whitespace' ); done(); }); }); @@ -166,9 +166,9 @@ module.exports.tests.functional = function(test, common){ body: { query: { bool: { must: [ { match: { 'address_parts.zip': 'E2-4DN' } } ]}}} - }, function( err, res ){ - t.equal( err, undefined ); - t.equal( getTotalHits(res.hits), 1, 'match zip - string - punct' ); + }, (err, { body }) => { + t.false(err); + t.equal( getTotalHits(body.hits), 1, 'match zip - string - punct' ); done(); }); }); @@ -180,9 +180,9 @@ module.exports.tests.functional = function(test, common){ body: { query: { bool: { must: [ { match: { 'address_parts.zip': 'E2 4DN' } } ]}}} - }, function( err, res ){ - t.equal( err, undefined ); - t.equal( getTotalHits(res.hits), 1, 'match zip - string - whitespace' ); + }, (err, { body }) => { + t.false(err); + t.equal( getTotalHits(body.hits), 1, 'match zip - string - whitespace' ); done(); }); }); @@ -289,10 +289,10 @@ module.exports.tests.venue_vs_address = function(test, common){ } } } - }, function( err, res ){ - t.equal( err, undefined ); - t.equal( getTotalHits(res.hits), TOTAL_ADDRESS_DOCS+1, 'matched all docs' ); - t.equal( res.hits.hits[TOTAL_ADDRESS_DOCS]._id, '1', 'exact name match first' ); + }, (err, { body }) => { + t.false(err); + t.equal( getTotalHits(body.hits), TOTAL_ADDRESS_DOCS+1, 'matched all docs' ); + t.equal( body.hits.hits[TOTAL_ADDRESS_DOCS]._id, '1', 'exact name match first' ); done(); }); }); diff --git a/integration/admin_abbreviations.js b/integration/admin_abbreviations.js index 20369180..666404c8 100644 --- a/integration/admin_abbreviations.js +++ b/integration/admin_abbreviations.js @@ -55,10 +55,10 @@ module.exports.tests.synonyms = function (test, common) { } } } - }, (err, res) => { - t.equal(err, undefined); - t.equal(getTotalHits(res.hits), 2, 'matches both documents'); - t.equal(res.hits.hits[0]._score, res.hits.hits[1]._score, 'scores match'); + }, (err, { body }) => { + t.false(err); + t.equal(getTotalHits(body.hits), 2, 'matches both documents'); + t.equal(body.hits.hits[0]._score, body.hits.hits[1]._score, 'scores match'); done(); }); }); @@ -77,10 +77,10 @@ module.exports.tests.synonyms = function (test, common) { } } } - }, (err, res) => { - t.equal(err, undefined); - t.equal(getTotalHits(res.hits), 2, 'matches both documents'); - t.equal(res.hits.hits[0]._score, res.hits.hits[1]._score, 'scores match'); + }, (err, { body }) => { + t.false(err); + t.equal(getTotalHits(body.hits), 2, 'matches both documents'); + t.equal(body.hits.hits[0]._score, body.hits.hits[1]._score, 'scores match'); done(); }); }); @@ -99,10 +99,10 @@ module.exports.tests.synonyms = function (test, common) { } } } - }, (err, res) => { - t.equal(err, undefined); - t.equal(getTotalHits(res.hits), 2, 'matches both documents'); - t.equal(res.hits.hits[0]._score, res.hits.hits[1]._score, 'scores match'); + }, (err, { body }) => { + t.false(err); + t.equal(getTotalHits(body.hits), 2, 'matches both documents'); + t.equal(body.hits.hits[0]._score, body.hits.hits[1]._score, 'scores match'); done(); }); }); @@ -121,10 +121,10 @@ module.exports.tests.synonyms = function (test, common) { } } } - }, (err, res) => { - t.equal(err, undefined); - t.equal(getTotalHits(res.hits), 2, 'matches both documents'); - t.equal(res.hits.hits[0]._score, res.hits.hits[1]._score, 'scores match'); + }, (err, { body }) => { + t.false(err); + t.equal(getTotalHits(body.hits), 2, 'matches both documents'); + t.equal(body.hits.hits[0]._score, body.hits.hits[1]._score, 'scores match'); done(); }); }); @@ -177,10 +177,10 @@ module.exports.tests.synonyms = function (test, common) { } } } - }, (err, res) => { - t.equal(err, undefined); - t.equal(getTotalHits(res.hits), 2, 'matches both documents'); - t.equal(res.hits.hits[0]._score, res.hits.hits[1]._score, 'scores match'); + }, (err, { body }) => { + t.false(err); + t.equal(getTotalHits(body.hits), 2, 'matches both documents'); + t.equal(body.hits.hits[0]._score, body.hits.hits[1]._score, 'scores match'); done(); }); }); @@ -199,10 +199,10 @@ module.exports.tests.synonyms = function (test, common) { } } } - }, (err, res) => { - t.equal(err, undefined); - t.equal(getTotalHits(res.hits), 2, 'matches both documents'); - t.equal(res.hits.hits[0]._score, res.hits.hits[1]._score, 'scores match'); + }, (err, { body }) => { + t.false(err); + t.equal(getTotalHits(body.hits), 2, 'matches both documents'); + t.equal(body.hits.hits[0]._score, body.hits.hits[1]._score, 'scores match'); done(); }); }); @@ -221,10 +221,10 @@ module.exports.tests.synonyms = function (test, common) { } } } - }, (err, res) => { - t.equal(err, undefined); - t.equal(getTotalHits(res.hits), 2, 'matches both documents'); - t.equal(res.hits.hits[0]._score, res.hits.hits[1]._score, 'scores match'); + }, (err, { body }) => { + t.false(err); + t.equal(getTotalHits(body.hits), 2, 'matches both documents'); + t.equal(body.hits.hits[0]._score, body.hits.hits[1]._score, 'scores match'); done(); }); }); @@ -243,10 +243,10 @@ module.exports.tests.synonyms = function (test, common) { } } } - }, (err, res) => { - t.equal(err, undefined); - t.equal(getTotalHits(res.hits), 2, 'matches both documents'); - t.equal(res.hits.hits[0]._score, res.hits.hits[1]._score, 'scores match'); + }, (err, { body }) => { + t.false(err); + t.equal(getTotalHits(body.hits), 2, 'matches both documents'); + t.equal(body.hits.hits[0]._score, body.hits.hits[1]._score, 'scores match'); done(); }); }); @@ -311,10 +311,10 @@ module.exports.tests.synonyms = function (test, common) { } } } - }, (err, res) => { - t.equal(err, undefined); - t.equal(getTotalHits(res.hits), 2, 'matches both documents'); - t.equal(res.hits.hits[0]._score, res.hits.hits[1]._score, 'scores match'); + }, (err, { body }) => { + t.false(err); + t.equal(getTotalHits(body.hits), 2, 'matches both documents'); + t.equal(body.hits.hits[0]._score, body.hits.hits[1]._score, 'scores match'); done(); }); }); diff --git a/integration/admin_matching.js b/integration/admin_matching.js index 7d1de3b0..ead3dc45 100644 --- a/integration/admin_matching.js +++ b/integration/admin_matching.js @@ -46,9 +46,9 @@ module.exports.tests.functional = function(test, common){ suite.client.search({ index: suite.props.index, body: { query: { match: { 'parent.country': 'Test Country' } } } - }, function( err, res ){ - t.equal( err, undefined ); - t.equal( getTotalHits(res.hits), 1, 'document found' ); + }, (err, { body }) => { + t.false(err); + t.equal( getTotalHits(body.hits), 1, 'document found' ); done(); }); }); @@ -58,9 +58,9 @@ module.exports.tests.functional = function(test, common){ suite.client.search({ index: suite.props.index, body: { query: { match: { 'parent.country_a': 'TestCountry' } } } - }, function( err, res ){ - t.equal( err, undefined ); - t.equal( getTotalHits(res.hits), 1, 'document found' ); + }, (err, { body }) => { + t.false(err); + t.equal( getTotalHits(body.hits), 1, 'document found' ); done(); }); }); @@ -70,9 +70,9 @@ module.exports.tests.functional = function(test, common){ suite.client.search({ index: suite.props.index, body: { query: { match: { 'parent.country_id': '100' } } } - }, function( err, res ){ - t.equal( err, undefined ); - t.equal( getTotalHits(res.hits), 1, 'document found' ); + }, (err, { body }) => { + t.false(err); + t.equal( getTotalHits(body.hits), 1, 'document found' ); done(); }); }); diff --git a/integration/analyzer_peliasPhrase.js b/integration/analyzer_peliasPhrase.js index 11828cd6..d207ee04 100644 --- a/integration/analyzer_peliasPhrase.js +++ b/integration/analyzer_peliasPhrase.js @@ -215,12 +215,12 @@ module.exports.tests.slop_query = function(test, common){ suite.assert( function( done ){ suite.client.search({ index: suite.props.index, - type: config.schema.typeName, searchType: 'dfs_query_then_fetch', body: buildQuery('Lake Cayuga') - }, function( err, res ){ - t.equal( getTotalHits(res.hits), 3 ); - var hits = res.hits.hits; + }, (err, { body }) => { + t.false(err); + t.equal( getTotalHits(body.hits), 3 ); + var hits = body.hits.hits; t.equal( hits[0]._source.name.default, 'Lake Cayuga' ); @@ -273,9 +273,9 @@ module.exports.tests.slop = function(test, common){ 'slop': 3, } }}} - }, function( err, res ){ - t.equal( err, undefined ); - t.equal( getTotalHits(res.hits), 1, 'document found' ); + }, (err, { body }) => { + t.false(err); + t.equal( getTotalHits(body.hits), 1, 'document found' ); done(); }); }); diff --git a/integration/autocomplete_abbreviated_street_names.js b/integration/autocomplete_abbreviated_street_names.js index fde4add4..678842c0 100644 --- a/integration/autocomplete_abbreviated_street_names.js +++ b/integration/autocomplete_abbreviated_street_names.js @@ -36,9 +36,9 @@ module.exports.tests.index_expanded_form_search_contracted = function(test, comm 'query': 'Grolmanstr.' } }}} - }, function( err, res ){ - t.equal( err, undefined ); - t.equal( getTotalHits(res.hits), 1, 'document found' ); + }, (err, { body }) => { + t.false(err); + t.equal( getTotalHits(body.hits), 1, 'document found' ); done(); }); }); @@ -78,9 +78,9 @@ module.exports.tests.index_expanded_form_search_contracted = function(test, comm // 'query': 'Grolmanstraße' // } // }}} -// }, function( err, res ){ -// t.equal( err, undefined ); -// t.equal( getTotalHits(res.hits), 1, 'document found' ); +// }, (err, { body }) => { +// t.false(err); +// t.equal( getTotalHits(body.hits), 1, 'document found' ); // done(); // }); // }); @@ -98,9 +98,9 @@ module.exports.tests.index_expanded_form_search_contracted = function(test, comm // 'query': 'Grolmanstraße' // } // }}} -// }, function( err, res ){ -// t.equal( err, undefined ); -// t.equal( getTotalHits(res.hits), 1, 'document found' ); +// }, (err, { body }) => { +// t.false(err); +// t.equal( getTotalHits(body.hits), 1, 'document found' ); // done(); // }); // }); diff --git a/integration/autocomplete_directional_synonym_expansion.js b/integration/autocomplete_directional_synonym_expansion.js index 4f409ae6..2496376a 100644 --- a/integration/autocomplete_directional_synonym_expansion.js +++ b/integration/autocomplete_directional_synonym_expansion.js @@ -36,9 +36,9 @@ module.exports.tests.index_and_retrieve_expanded_form = function(test, common){ 'query': 'nor' } }}} - }, function( err, res ){ - t.equal( err, undefined ); - t.equal( getTotalHits(res.hits), 1, 'document found' ); + }, (err, { body }) => { + t.false(err); + t.equal( getTotalHits(body.hits), 1, 'document found' ); done(); }); }); @@ -53,9 +53,9 @@ module.exports.tests.index_and_retrieve_expanded_form = function(test, common){ 'query': 'north' } }}} - }, function( err, res ){ - t.equal( err, undefined ); - t.equal( getTotalHits(res.hits), 1, 'document found' ); + }, (err, { body }) => { + t.false(err); + t.equal( getTotalHits(body.hits), 1, 'document found' ); done(); }); }); @@ -90,9 +90,9 @@ module.exports.tests.index_and_retrieve_contracted_form = function(test, common) 'query': 'n' } }}} - }, function( err, res ){ - t.equal( err, undefined ); - t.equal( getTotalHits(res.hits), 1, 'document found' ); + }, (err, { body }) => { + t.false(err); + t.equal( getTotalHits(body.hits), 1, 'document found' ); done(); }); }); @@ -127,9 +127,9 @@ module.exports.tests.index_and_retrieve_mixed_form_1 = function(test, common){ 'query': 'nor' } }}} - }, function( err, res ){ - t.equal( err, undefined ); - t.equal( getTotalHits(res.hits), 1, 'document found' ); + }, (err, { body }) => { + t.false(err); + t.equal( getTotalHits(body.hits), 1, 'document found' ); done(); }); }); @@ -144,9 +144,9 @@ module.exports.tests.index_and_retrieve_mixed_form_1 = function(test, common){ 'query': 'north' } }}} - }, function( err, res ){ - t.equal( err, undefined ); - t.equal( getTotalHits(res.hits), 1, 'document found' ); + }, (err, { body }) => { + t.false(err); + t.equal( getTotalHits(body.hits), 1, 'document found' ); done(); }); }); @@ -181,9 +181,9 @@ module.exports.tests.index_and_retrieve_mixed_form_2 = function(test, common){ 'query': 'n' } }}} - }, function( err, res ){ - t.equal( err, undefined ); - t.equal( getTotalHits(res.hits), 1, 'document found' ); + }, (err, { body }) => { + t.false(err); + t.equal( getTotalHits(body.hits), 1, 'document found' ); done(); }); }); diff --git a/integration/autocomplete_street_synonym_expansion.js b/integration/autocomplete_street_synonym_expansion.js index c2c21e6f..ff789eb2 100644 --- a/integration/autocomplete_street_synonym_expansion.js +++ b/integration/autocomplete_street_synonym_expansion.js @@ -37,9 +37,9 @@ module.exports.tests.index_and_retrieve_expanded_form = function(test, common){ 'query': 'cent' } }}} - }, function( err, res ){ - t.equal( err, undefined ); - t.equal( getTotalHits(res.hits), 1, 'document found' ); + }, (err, { body }) => { + t.false(err); + t.equal( getTotalHits(body.hits), 1, 'document found' ); done(); }); }); @@ -54,9 +54,9 @@ module.exports.tests.index_and_retrieve_expanded_form = function(test, common){ 'query': 'center' } }}} - }, function( err, res ){ - t.equal( err, undefined ); - t.equal( getTotalHits(res.hits), 1, 'document found' ); + }, (err, { body }) => { + t.false(err); + t.equal( getTotalHits(body.hits), 1, 'document found' ); done(); }); }); @@ -91,9 +91,9 @@ module.exports.tests.index_and_retrieve_contracted_form = function(test, common) 'query': 'ctr' } }}} - }, function( err, res ){ - t.equal( err, undefined ); - t.equal( getTotalHits(res.hits), 1, 'document found' ); + }, (err, { body }) => { + t.false(err); + t.equal( getTotalHits(body.hits), 1, 'document found' ); done(); }); }); @@ -128,9 +128,9 @@ module.exports.tests.index_and_retrieve_mixed_form_1 = function(test, common){ 'query': 'cent' } }}} - }, function( err, res ){ - t.equal( err, undefined ); - t.equal( getTotalHits(res.hits), 1, 'document found' ); + }, (err, { body }) => { + t.false(err); + t.equal( getTotalHits(body.hits), 1, 'document found' ); done(); }); }); @@ -145,9 +145,9 @@ module.exports.tests.index_and_retrieve_mixed_form_1 = function(test, common){ 'query': 'center' } }}} - }, function( err, res ){ - t.equal( err, undefined ); - t.equal( getTotalHits(res.hits), 1, 'document found' ); + }, (err, { body }) => { + t.false(err); + t.equal( getTotalHits(body.hits), 1, 'document found' ); done(); }); }); @@ -182,9 +182,9 @@ module.exports.tests.index_and_retrieve_mixed_form_2 = function(test, common){ 'query': 'ctr' } }}} - }, function( err, res ){ - t.equal( err, undefined ); - t.equal( getTotalHits(res.hits), 1, 'document found' ); + }, (err, { body }) => { + t.false(err); + t.equal( getTotalHits(body.hits), 1, 'document found' ); done(); }); }); diff --git a/integration/bounding_box.js b/integration/bounding_box.js index 21e5c864..e7413f85 100644 --- a/integration/bounding_box.js +++ b/integration/bounding_box.js @@ -29,9 +29,9 @@ module.exports.tests.index_and_retrieve = function(test, common){ index: suite.props.index, id: '1' }, - function (err, res) { - t.equal(err, undefined); - t.deepEqual(res._source.bounding_box, '{"min_lat":-47.75,"max_lat":-33.9,"min_lon":163.82,"max_lon":179.42}'); + function (err, { body }) { + t.false(err); + t.deepEqual(body._source.bounding_box, '{"min_lat":-47.75,"max_lat":-33.9,"min_lon":163.82,"max_lon":179.42}'); done(); } ); diff --git a/integration/dynamic_templates.js b/integration/dynamic_templates.js index 6e64a09c..f0804e8c 100644 --- a/integration/dynamic_templates.js +++ b/integration/dynamic_templates.js @@ -48,9 +48,8 @@ function nameAssertion( analyzer, common ){ suite.client.indices.getMapping({ index: suite.props.index, - }, (err, res) => { - - const properties = res[suite.props.index].mappings.properties; + }, (err, { body }) => { + const properties = body[suite.props.index].mappings.properties; t.equal( properties.name.dynamic, 'true' ); const nameProperties = properties.name.properties; @@ -84,9 +83,9 @@ function phraseAssertion( analyzer, common ){ suite.client.indices.getMapping({ index: suite.props.index, - }, ( err, res ) => { + }, ( err, { body }) => { - const properties = res[suite.props.index].mappings.properties; + const properties = body[suite.props.index].mappings.properties; t.equal( properties.phrase.dynamic, 'true' ); const phraseProperties = properties.phrase.properties; @@ -119,9 +118,9 @@ function addendumAssertion( namespace, value, common ){ suite.assert( done => { suite.client.indices.getMapping({ index: suite.props.index, - }, ( err, res ) => { + }, ( err, { body }) => { - const properties = res[suite.props.index].mappings.properties; + const properties = body[suite.props.index].mappings.properties; t.equal( properties.addendum.dynamic, 'true' ); const addendumProperties = properties.addendum.properties; @@ -148,9 +147,9 @@ function addendumAssertion( namespace, value, common ){ suite.client.get({ index: suite.props.index, id: 1 - }, ( err, res ) => { + }, ( err, { body }) => { t.false( err ); - t.equal( res._source.addendum[namespace], value ); + t.equal( body._source.addendum[namespace], value ); done(); }); }); diff --git a/integration/run.js b/integration/run.js index 00686dec..26a1c396 100644 --- a/integration/run.js +++ b/integration/run.js @@ -9,7 +9,7 @@ const common = { create: { } }, summaryMap: (res) => { - return res.hits.hits.map(h => { + return res.body.hits.hits.map(h => { return { _id: h._id, _score: h._score, @@ -63,10 +63,10 @@ const common = { analyzer: analyzer, text: text.toString() } - }, (err, res) => { + }, (err, { body }) => { if (err) { console.error(err); } t.deepEqual({}, removeIndexTokensFromExpectedTokens( - common.bucketTokens(res.tokens), + common.bucketTokens(body.tokens), common.bucketTokens(expected) ), comment); done(); diff --git a/integration/source_layer_sourceid_filtering.js b/integration/source_layer_sourceid_filtering.js index 5b3e5cb5..731a2692 100644 --- a/integration/source_layer_sourceid_filtering.js +++ b/integration/source_layer_sourceid_filtering.js @@ -50,8 +50,8 @@ module.exports.tests.source_filter = function(test, common){ source: 'osm' } }} - }, function( err, res ){ - t.equal( getTotalHits(res.hits), 2 ); + }, (err, { body }) => { + t.equal( getTotalHits(body.hits), 2 ); done(); }); }); @@ -65,8 +65,8 @@ module.exports.tests.source_filter = function(test, common){ layer: 'address' } }} - }, function( err, res ){ - t.equal( getTotalHits(res.hits), 2 ); + }, (err, { body }) => { + t.equal( getTotalHits(body.hits), 2 ); done(); }); }); @@ -80,8 +80,8 @@ module.exports.tests.source_filter = function(test, common){ source_id: 'dataset/1' } }} - }, function( err, res ){ - t.equal( getTotalHits(res.hits), 2 ); + }, (err, { body }) => { + t.equal( getTotalHits(body.hits), 2 ); done(); }); }); @@ -94,8 +94,8 @@ module.exports.tests.source_filter = function(test, common){ { term: { source: 'osm' } }, { term: { source_id: 'dataset/1' } } ]}}} - }, function( err, res ){ - t.equal( getTotalHits(res.hits), 1 ); + }, (err, { body }) => { + t.equal( getTotalHits(body.hits), 1 ); done(); }); }); @@ -109,8 +109,8 @@ module.exports.tests.source_filter = function(test, common){ source: 'OSM' } }} - }, function( err, res ){ - t.equal( getTotalHits(res.hits), 0 ); + }, (err, { body }) => { + t.equal( getTotalHits(body.hits), 0 ); done(); }); }); @@ -124,8 +124,8 @@ module.exports.tests.source_filter = function(test, common){ source: 'foo' } }} - }, function( err, res ){ - t.equal( getTotalHits(res.hits), 0 ); + }, (err, { body }) => { + t.equal( getTotalHits(body.hits), 0 ); done(); }); }); @@ -139,8 +139,8 @@ module.exports.tests.source_filter = function(test, common){ source: 'foo bar baz' } }} - }, function( err, res ){ - t.equal( getTotalHits(res.hits), 1 ); + }, (err, { body }) => { + t.equal( getTotalHits(body.hits), 1 ); done(); }); }); diff --git a/integration/validate.js b/integration/validate.js index 31622e98..a850cadd 100644 --- a/integration/validate.js +++ b/integration/validate.js @@ -11,8 +11,8 @@ module.exports.tests.validate = function(test, common){ var suite = new Suite( common.clientOpts, common.create ); suite.assert( done => { - suite.client.info({}, ( err, res, status ) => { - t.equal( status, 200 ); + suite.client.info(( err, { statusCode }) => { + t.equal( statusCode, 200 ); done(); }); });