You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
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);
|
|
|
|
}
|
|
|
|
};
|