mirror of https://github.com/pelias/api.git
Julian Simioni
9 years ago
10 changed files with 53 additions and 14 deletions
@ -1,4 +1,4 @@
|
||||
var parser = require('../../../helper/query_parser'); |
||||
var parser = require('../../../helper/text_parser'); |
||||
|
||||
var type_mapping = require('../../../helper/type_mapping'); |
||||
var layers_map = type_mapping.layer_with_aliases_to_type; |
@ -0,0 +1,32 @@
|
||||
var sanitiser = require('../../../sanitiser/_text'); |
||||
var type_mapping = require('../../../helper/type_mapping'); |
||||
|
||||
module.exports.tests = {}; |
||||
|
||||
module.exports.tests.text_parser = function(test, common) { |
||||
test('short input text has admin layers set ', function(t) { |
||||
var raw = { |
||||
text: 'emp' //start of empire state building
|
||||
}; |
||||
var clean = { |
||||
}; |
||||
|
||||
var messages = sanitiser(raw, clean); |
||||
|
||||
t.deepEquals(messages.errors, [], 'no errors'); |
||||
t.deepEquals(messages.warnings, [], 'no warnings'); |
||||
t.equal(clean.types.from_text_parser, type_mapping.layer_with_aliases_to_type.coarse, 'coarse layers preferred'); |
||||
|
||||
t.end(); |
||||
}); |
||||
}; |
||||
|
||||
module.exports.all = function (tape, common) { |
||||
function test(name, testFunction) { |
||||
return tape('SANITISER _text: ' + name, testFunction); |
||||
} |
||||
|
||||
for( var testCase in module.exports.tests ){ |
||||
module.exports.tests[testCase](test, common); |
||||
} |
||||
}; |
Loading…
Reference in new issue