mirror of https://github.com/pelias/api.git
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.
35 lines
873 B
35 lines
873 B
const sanitizer = require('../../../sanitizer/_request_language')(); |
|
|
|
module.exports.tests = {}; |
|
|
|
module.exports.tests.do_nothing = (test, common) => { |
|
test('sanitize should return empty warnings/erros', t => { |
|
const messages = sanitizer.sanitize(); |
|
|
|
t.deepEquals(messages.errors, [], 'no errors'); |
|
t.deepEquals(messages.warnings, [], 'no warnings'); |
|
t.end(); |
|
|
|
}); |
|
|
|
}; |
|
|
|
module.exports.tests.expected = (test, common) => { |
|
test('expected should contain only \'lang\'', t => { |
|
const expected = sanitizer.expected(); |
|
|
|
t.deepEquals(expected, [{'name': 'lang'}]); |
|
t.end(); |
|
|
|
}); |
|
}; |
|
|
|
module.exports.all = (tape, common) => { |
|
function test(name, testFunction) { |
|
return tape(`SANITIZE _request_language: ${name}`, testFunction); |
|
} |
|
|
|
for( const testCase in module.exports.tests ){ |
|
module.exports.tests[testCase](test, common); |
|
} |
|
};
|
|
|