|
|
|
@ -94,6 +94,36 @@ module.exports.tests.confidenceScore = function(test, common) {
|
|
|
|
|
t.end(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test('undefined region fields should be handled gracefully', function(t) { |
|
|
|
|
var req = { |
|
|
|
|
clean: { |
|
|
|
|
text: 'test name1, TX', |
|
|
|
|
parsed_text: { |
|
|
|
|
state: 'TX' |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
var res = { |
|
|
|
|
data: [{ |
|
|
|
|
_score: 10, |
|
|
|
|
found: true, |
|
|
|
|
value: 1, |
|
|
|
|
center_point: { lat: 100.1, lon: -50.5 }, |
|
|
|
|
name: { default: 'test name1' }, |
|
|
|
|
parent: { |
|
|
|
|
country: ['country1'], |
|
|
|
|
region: undefined, |
|
|
|
|
region_a: undefined, |
|
|
|
|
county: ['city1'] |
|
|
|
|
} |
|
|
|
|
}], |
|
|
|
|
meta: {scores: [10]} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
confidenceScore(req, res, function() {}); |
|
|
|
|
t.equal(res.data[0].confidence, 0.54, 'score was set'); |
|
|
|
|
t.end(); |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
module.exports.all = function (tape, common) { |
|
|
|
|