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
950 B
35 lines
950 B
10 years ago
|
|
||
|
var controller = require('../../../controller/index');
|
||
|
|
||
|
module.exports.tests = {};
|
||
|
|
||
|
module.exports.tests.interface = function(test, common) {
|
||
|
test('valid interface', function(t) {
|
||
|
t.equal(typeof controller, 'function', 'controller is a function');
|
||
|
t.end();
|
||
|
});
|
||
|
};
|
||
|
|
||
|
module.exports.tests.info = function(test, common) {
|
||
|
test('returns server info', function(t) {
|
||
|
var res = { json: function( json ){
|
||
|
t.equal(typeof json, 'object', 'returns json');
|
||
|
t.equal(typeof json.name, 'string', 'name');
|
||
|
t.equal(typeof json.version, 'object', 'version');
|
||
|
t.equal(typeof json.version.number, 'string', 'version number');
|
||
|
t.end();
|
||
|
}};
|
||
|
controller( null, res );
|
||
|
});
|
||
|
};
|
||
|
|
||
|
module.exports.all = function (tape, common) {
|
||
|
|
||
|
function test(name, testFunction) {
|
||
|
return tape(name + ' / ' , testFunction);
|
||
|
}
|
||
|
|
||
|
for( var testCase in module.exports.tests ){
|
||
|
module.exports.tests[testCase](test, common);
|
||
|
}
|
||
|
};
|