|
|
@ -1,4 +1,4 @@ |
|
|
|
var generate = require('../../../query/component_geocoding'); |
|
|
|
var generate = require('../../../query/structured_geocoding'); |
|
|
|
var fs = require('fs'); |
|
|
|
var fs = require('fs'); |
|
|
|
|
|
|
|
|
|
|
|
module.exports.tests = {}; |
|
|
|
module.exports.tests = {}; |
|
|
@ -28,7 +28,7 @@ module.exports.tests.query = function(test, common) { |
|
|
|
var query = generate(clean); |
|
|
|
var query = generate(clean); |
|
|
|
|
|
|
|
|
|
|
|
var compiled = JSON.parse( JSON.stringify( query ) ); |
|
|
|
var compiled = JSON.parse( JSON.stringify( query ) ); |
|
|
|
var expected = require('../fixture/component_geocoding/linguistic_focus_bbox'); |
|
|
|
var expected = require('../fixture/structured_geocoding/linguistic_focus_bbox'); |
|
|
|
|
|
|
|
|
|
|
|
t.deepEqual(compiled.type, 'fallback', 'query type set'); |
|
|
|
t.deepEqual(compiled.type, 'fallback', 'query type set'); |
|
|
|
t.deepEqual(compiled.body, expected, 'search_linguistic_focus_bbox'); |
|
|
|
t.deepEqual(compiled.body, expected, 'search_linguistic_focus_bbox'); |
|
|
@ -51,7 +51,7 @@ module.exports.tests.query = function(test, common) { |
|
|
|
var query = generate(clean); |
|
|
|
var query = generate(clean); |
|
|
|
|
|
|
|
|
|
|
|
var compiled = JSON.parse( JSON.stringify( query ) ); |
|
|
|
var compiled = JSON.parse( JSON.stringify( query ) ); |
|
|
|
var expected = require('../fixture/component_geocoding/linguistic_bbox'); |
|
|
|
var expected = require('../fixture/structured_geocoding/linguistic_bbox'); |
|
|
|
|
|
|
|
|
|
|
|
t.deepEqual(compiled.type, 'fallback', 'query type set'); |
|
|
|
t.deepEqual(compiled.type, 'fallback', 'query type set'); |
|
|
|
t.deepEqual(compiled.body, expected, 'search_linguistic_bbox'); |
|
|
|
t.deepEqual(compiled.body, expected, 'search_linguistic_bbox'); |
|
|
@ -69,7 +69,7 @@ module.exports.tests.query = function(test, common) { |
|
|
|
var query = generate(clean); |
|
|
|
var query = generate(clean); |
|
|
|
|
|
|
|
|
|
|
|
var compiled = JSON.parse( JSON.stringify( query ) ); |
|
|
|
var compiled = JSON.parse( JSON.stringify( query ) ); |
|
|
|
var expected = require('../fixture/component_geocoding/linguistic_only'); |
|
|
|
var expected = require('../fixture/structured_geocoding/linguistic_only'); |
|
|
|
|
|
|
|
|
|
|
|
t.deepEqual(compiled.type, 'fallback', 'query type set'); |
|
|
|
t.deepEqual(compiled.type, 'fallback', 'query type set'); |
|
|
|
t.deepEqual(compiled.body, expected, 'search_linguistic_only'); |
|
|
|
t.deepEqual(compiled.body, expected, 'search_linguistic_only'); |
|
|
@ -88,7 +88,7 @@ module.exports.tests.query = function(test, common) { |
|
|
|
var query = generate(clean); |
|
|
|
var query = generate(clean); |
|
|
|
|
|
|
|
|
|
|
|
var compiled = JSON.parse( JSON.stringify( query ) ); |
|
|
|
var compiled = JSON.parse( JSON.stringify( query ) ); |
|
|
|
var expected = require('../fixture/component_geocoding/linguistic_focus'); |
|
|
|
var expected = require('../fixture/structured_geocoding/linguistic_focus'); |
|
|
|
|
|
|
|
|
|
|
|
t.deepEqual(compiled.type, 'fallback', 'query type set'); |
|
|
|
t.deepEqual(compiled.type, 'fallback', 'query type set'); |
|
|
|
t.deepEqual(compiled.body, expected, 'search_linguistic_focus'); |
|
|
|
t.deepEqual(compiled.body, expected, 'search_linguistic_focus'); |
|
|
@ -110,7 +110,7 @@ module.exports.tests.query = function(test, common) { |
|
|
|
var query = generate(clean); |
|
|
|
var query = generate(clean); |
|
|
|
|
|
|
|
|
|
|
|
var compiled = JSON.parse( JSON.stringify( query ) ); |
|
|
|
var compiled = JSON.parse( JSON.stringify( query ) ); |
|
|
|
var expected = require('../fixture/component_geocoding/linguistic_viewport'); |
|
|
|
var expected = require('../fixture/structured_geocoding/linguistic_viewport'); |
|
|
|
|
|
|
|
|
|
|
|
t.deepEqual(compiled.type, 'fallback', 'query type set'); |
|
|
|
t.deepEqual(compiled.type, 'fallback', 'query type set'); |
|
|
|
t.deepEqual(compiled.body, expected, 'search_linguistic_viewport'); |
|
|
|
t.deepEqual(compiled.body, expected, 'search_linguistic_viewport'); |
|
|
@ -134,7 +134,7 @@ module.exports.tests.query = function(test, common) { |
|
|
|
var query = generate(clean); |
|
|
|
var query = generate(clean); |
|
|
|
|
|
|
|
|
|
|
|
var compiled = JSON.parse( JSON.stringify( query ) ); |
|
|
|
var compiled = JSON.parse( JSON.stringify( query ) ); |
|
|
|
var expected = require('../fixture/component_geocoding/linguistic_viewport_min_diagonal'); |
|
|
|
var expected = require('../fixture/structured_geocoding/linguistic_viewport_min_diagonal'); |
|
|
|
|
|
|
|
|
|
|
|
t.deepEqual(compiled.type, 'fallback', 'query type set'); |
|
|
|
t.deepEqual(compiled.type, 'fallback', 'query type set'); |
|
|
|
t.deepEqual(compiled.body, expected, 'valid search query'); |
|
|
|
t.deepEqual(compiled.body, expected, 'valid search query'); |
|
|
@ -153,7 +153,7 @@ module.exports.tests.query = function(test, common) { |
|
|
|
var query = generate(clean); |
|
|
|
var query = generate(clean); |
|
|
|
|
|
|
|
|
|
|
|
var compiled = JSON.parse( JSON.stringify( query ) ); |
|
|
|
var compiled = JSON.parse( JSON.stringify( query ) ); |
|
|
|
var expected = require('../fixture/component_geocoding/linguistic_focus_null_island'); |
|
|
|
var expected = require('../fixture/structured_geocoding/linguistic_focus_null_island'); |
|
|
|
|
|
|
|
|
|
|
|
t.deepEqual(compiled.type, 'fallback', 'query type set'); |
|
|
|
t.deepEqual(compiled.type, 'fallback', 'query type set'); |
|
|
|
t.deepEqual(compiled.body, expected, 'search_linguistic_focus_null_island'); |
|
|
|
t.deepEqual(compiled.body, expected, 'search_linguistic_focus_null_island'); |
|
|
@ -180,7 +180,7 @@ module.exports.tests.query = function(test, common) { |
|
|
|
var query = generate(clean); |
|
|
|
var query = generate(clean); |
|
|
|
|
|
|
|
|
|
|
|
var compiled = JSON.parse(JSON.stringify(query)); |
|
|
|
var compiled = JSON.parse(JSON.stringify(query)); |
|
|
|
var expected = require('../fixture/component_geocoding/fallback'); |
|
|
|
var expected = require('../fixture/structured_geocoding/fallback'); |
|
|
|
|
|
|
|
|
|
|
|
t.deepEqual(compiled.type, 'fallback', 'query type set'); |
|
|
|
t.deepEqual(compiled.type, 'fallback', 'query type set'); |
|
|
|
t.deepEqual(compiled.body, expected, 'fallbackQuery'); |
|
|
|
t.deepEqual(compiled.body, expected, 'fallbackQuery'); |
|
|
@ -200,7 +200,7 @@ module.exports.tests.query = function(test, common) { |
|
|
|
var query = generate(clean); |
|
|
|
var query = generate(clean); |
|
|
|
|
|
|
|
|
|
|
|
var compiled = JSON.parse( JSON.stringify( query ) ); |
|
|
|
var compiled = JSON.parse( JSON.stringify( query ) ); |
|
|
|
var expected = require('../fixture/component_geocoding/boundary_country'); |
|
|
|
var expected = require('../fixture/structured_geocoding/boundary_country'); |
|
|
|
|
|
|
|
|
|
|
|
t.deepEqual(compiled.type, 'fallback', 'query type set'); |
|
|
|
t.deepEqual(compiled.type, 'fallback', 'query type set'); |
|
|
|
t.deepEqual(compiled.body, expected, 'search: valid boundary.country query'); |
|
|
|
t.deepEqual(compiled.body, expected, 'search: valid boundary.country query'); |
|
|
@ -218,7 +218,7 @@ module.exports.tests.query = function(test, common) { |
|
|
|
var query = generate(clean); |
|
|
|
var query = generate(clean); |
|
|
|
|
|
|
|
|
|
|
|
var compiled = JSON.parse( JSON.stringify( query ) ); |
|
|
|
var compiled = JSON.parse( JSON.stringify( query ) ); |
|
|
|
var expected = require('../fixture/component_geocoding/with_source_filtering'); |
|
|
|
var expected = require('../fixture/structured_geocoding/with_source_filtering'); |
|
|
|
|
|
|
|
|
|
|
|
t.deepEqual(compiled.type, 'fallback', 'query type set'); |
|
|
|
t.deepEqual(compiled.type, 'fallback', 'query type set'); |
|
|
|
t.deepEqual(compiled.body, expected, 'search: valid search query with source filtering'); |
|
|
|
t.deepEqual(compiled.body, expected, 'search: valid search query with source filtering'); |
|
|
@ -229,7 +229,7 @@ module.exports.tests.query = function(test, common) { |
|
|
|
|
|
|
|
|
|
|
|
module.exports.all = function (tape, common) { |
|
|
|
module.exports.all = function (tape, common) { |
|
|
|
function test(name, testFunction) { |
|
|
|
function test(name, testFunction) { |
|
|
|
return tape('component_geocoding query ' + name, testFunction); |
|
|
|
return tape('structured_geocoding query ' + name, testFunction); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for( var testCase in module.exports.tests ){ |
|
|
|
for( var testCase in module.exports.tests ){ |