Browse Source

tests

pull/96/head
Harish Krishna 10 years ago
parent
commit
f13f1cdf2c
  1. 112
      test/unit/query/search.js

112
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();
});
@ -116,43 +117,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();
});

Loading…
Cancel
Save