mirror of https://github.com/pelias/api.git
Browse Source
The parameter in clean.types being set by `helpers/text_parser.js` was "from_address_parsing", but the code in `helper/types.js` was expecting "from_address_parser". This commit makes both use "from_address_parser" and adds a test.pull/347/head
Julian Simioni
9 years ago
3 changed files with 34 additions and 1 deletions
@ -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_address_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