From f13f1cdf2cc4cc2fa6fcd95e22026b0ec6792d3b Mon Sep 17 00:00:00 2001 From: Harish Krishna Date: Tue, 7 Apr 2015 14:40:38 -0400 Subject: [PATCH] tests --- test/unit/query/search.js | 112 +++++++++++++------------------------- 1 file changed, 38 insertions(+), 74 deletions(-) diff --git a/test/unit/query/search.js b/test/unit/query/search.js index 1e5301e3..82a23239 100644 --- a/test/unit/query/search.js +++ b/test/unit/query/search.js @@ -49,6 +49,44 @@ var sort = [ } ]; +var expected = { + 'query': { + 'filtered': { + 'query': { + 'bool': { + 'must': [{ + 'match': { + 'name.default': 'test' + } + } + ] + } + }, + 'filter': { + 'bool': { + 'must': [ + { + 'geo_bounding_box': { + 'center_point': { + 'top': '47.47', + 'right': '-61.84', + 'bottom':'11.51', + 'left': '-103.16' + }, + '_cache': true, + 'type': 'indexed' + } + } + ] + } + } + } + }, + 'sort': sort, + 'size': 10, + 'track_scores': true +}; + module.exports.tests.query = function(test, common) { test('valid query', function(t) { var query = generate({ @@ -63,43 +101,6 @@ module.exports.tests.query = function(test, common) { layers: ['test'] }); - var expected = { - 'query': { - 'filtered': { - 'query': { - 'bool': { - 'must': [{ - 'match': { - 'name.default': 'test' - } - } - ] - } - }, - 'filter': { - 'bool': { - 'must': [ - { - 'geo_bounding_box': { - 'center_point': { - 'top': '47.47', - 'right': '-61.84', - 'bottom':'11.51', - 'left': '-103.16' - }, - '_cache': true - } - } - ] - } - } - } - }, - 'sort': sort, - 'size': 10, - 'track_scores': true - }; - t.deepEqual(query, expected, 'valid search query'); t.end(); }); @@ -115,43 +116,6 @@ module.exports.tests.query = function(test, common) { }, layers: ['test'] }); - - var expected = { - 'query': { - 'filtered': { - 'query': { - 'bool': { - 'must': [{ - 'match': { - 'name.default': 'test' - } - } - ] - } - }, - 'filter': { - 'bool': { - 'must': [ - { - 'geo_bounding_box': { - 'center_point': { - 'top': '47.47', - 'right': '-61.84', - 'bottom':'11.51', - 'left': '-103.16' - }, - '_cache': true - } - } - ] - } - } - } - }, - 'sort': sort, - 'size': 10, - 'track_scores': true - }; t.deepEqual(query, expected, 'valid search query'); t.end();