|
|
|
@ -29,7 +29,8 @@ module.exports.tests.query = function(test, common) {
|
|
|
|
|
precision: 1, |
|
|
|
|
value: [ 0, 0 ] |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
fuzzy: { fuzziness: 0 }, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
@ -82,7 +83,8 @@ module.exports.tests.precision = function(test, common) {
|
|
|
|
|
precision: test_case.precision, |
|
|
|
|
value: [ 0, 0 ] |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
fuzzy: { fuzziness: 0 }, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
@ -92,6 +94,38 @@ module.exports.tests.precision = function(test, common) {
|
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
module.exports.tests.fuzziness = function(test, common) { |
|
|
|
|
var test_cases = [0,1,2,'AUTO', undefined, null, '']; |
|
|
|
|
test('valid fuzziness', function(t) { |
|
|
|
|
test_cases.forEach( function( test_case ){ |
|
|
|
|
var query = generate({ |
|
|
|
|
input: 'test', size: 10, |
|
|
|
|
lat: 0, lon: 0, zoom:0, |
|
|
|
|
layers: ['test'] |
|
|
|
|
}, undefined, test_case); |
|
|
|
|
var expected = { |
|
|
|
|
pelias: { |
|
|
|
|
text: 'test', |
|
|
|
|
completion: { |
|
|
|
|
field: 'suggest', |
|
|
|
|
size: 10, |
|
|
|
|
context: { |
|
|
|
|
dataset: [ 'test' ], |
|
|
|
|
location: { |
|
|
|
|
precision: 1, |
|
|
|
|
value: [ 0, 0 ] |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
fuzzy: { fuzziness: test_case || 0 }, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
t.deepEqual(query, expected, 'valid suggest query for fuziness = ' + test_case); |
|
|
|
|
}); |
|
|
|
|
t.end(); |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
module.exports.all = function (tape, common) { |
|
|
|
|
|
|
|
|
|
function test(name, testFunction) { |
|
|
|
|