mirror of https://github.com/pelias/api.git
Julian Simioni
7 years ago
committed by
GitHub
16 changed files with 173 additions and 12 deletions
@ -1 +1,51 @@
|
||||
# Logs |
||||
logs |
||||
*.log |
||||
npm-debug.log* |
||||
yarn-debug.log* |
||||
yarn-error.log* |
||||
|
||||
# Runtime data |
||||
pids |
||||
*.pid |
||||
*.seed |
||||
*.pid.lock |
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover |
||||
lib-cov |
||||
|
||||
# Coverage directory used by tools like istanbul |
||||
coverage |
||||
|
||||
# nyc test coverage |
||||
.nyc_output |
||||
|
||||
# node-waf configuration |
||||
.lock-wscript |
||||
|
||||
# Compiled binary addons (http://nodejs.org/api/addons.html) |
||||
build/Release |
||||
|
||||
# Dependency directories |
||||
node_modules/ |
||||
|
||||
# Typescript v1 declaration files |
||||
typings/ |
||||
|
||||
# Optional npm cache directory |
||||
.npm |
||||
|
||||
# Optional eslint cache |
||||
.eslintcache |
||||
|
||||
# Optional REPL history |
||||
.node_repl_history |
||||
|
||||
# Output of 'npm pack' |
||||
*.tgz |
||||
|
||||
# Yarn Integrity file |
||||
.yarn-integrity |
||||
|
||||
# Git |
||||
.git |
||||
|
@ -0,0 +1,15 @@
|
||||
// this sanitizer exists solely to allow `lang` as a request parameter
|
||||
function _sanitize( raw, clean ){ |
||||
// error & warning messages
|
||||
return { errors: [], warnings: [] }; |
||||
} |
||||
|
||||
function _expected(){ |
||||
return [{ 'name': 'lang' }]; |
||||
} |
||||
|
||||
// export function
|
||||
module.exports = () => ({ |
||||
sanitize: _sanitize, |
||||
expected: _expected |
||||
}); |
@ -0,0 +1,35 @@
|
||||
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); |
||||
} |
||||
}; |
Loading…
Reference in new issue