From 7462e6bc804869812a01ddfc6f6f34b2b2440b16 Mon Sep 17 00:00:00 2001 From: Severyn Kozak Date: Tue, 12 May 2015 11:13:57 -0400 Subject: [PATCH] Move sort array into createExpectedQuery(). test/unit/query/search.js -The fact that it's a singleton was causing problems because at least one of the tests directly modifies it (this was one of the reasons why the base query itself was moved into `createExpectedQuery()`). -Move it into `createExpectedQuery()` as well. --- test/unit/query/search.js | 108 +++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/test/unit/query/search.js b/test/unit/query/search.js index a35de8bf..4d004552 100644 --- a/test/unit/query/search.js +++ b/test/unit/query/search.js @@ -16,62 +16,62 @@ module.exports.tests.interface = function(test, common) { }); }; -var sort = [ - '_score', - { - '_script': { - 'file': admin_boost, - 'type': 'number', - 'order': 'desc' - } - }, - { - '_script': { - 'file': population, - 'type': 'number', - 'order': 'desc' - } - }, - { - '_script': { - 'file': popularity, - 'type': 'number', - 'order': 'desc' - } - }, - { - '_script': { - 'params': { - 'category_weights': category_weights - }, - 'file': category, - 'type': 'number', - 'order': 'desc' - } - }, - { - '_script': { - 'params': { - 'weights': weights - }, - 'file': 'weights', - 'type': 'number', - 'order': 'desc' - } - }, - { - '_script': { - 'params': { - 'input': 'test' - }, - 'file': 'exact_match', - 'type': 'number', - 'order': 'desc' +function createExpectedQuery(){ + var sort = [ + '_score', + { + '_script': { + 'file': admin_boost, + 'type': 'number', + 'order': 'desc' + } + }, + { + '_script': { + 'file': population, + 'type': 'number', + 'order': 'desc' + } + }, + { + '_script': { + 'file': popularity, + 'type': 'number', + 'order': 'desc' + } + }, + { + '_script': { + 'params': { + 'category_weights': category_weights + }, + 'file': category, + 'type': 'number', + 'order': 'desc' + } + }, + { + '_script': { + 'params': { + 'weights': weights + }, + 'file': 'weights', + 'type': 'number', + 'order': 'desc' + } + }, + { + '_script': { + 'params': { + 'input': 'test' + }, + 'file': 'exact_match', + 'type': 'number', + 'order': 'desc' + } } - } -]; + ]; -function createExpectedQuery(){ return { 'query': { 'filtered': {