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.
43 lines
1.0 KiB
43 lines
1.0 KiB
8 years ago
|
'use strict';
|
||
|
|
||
|
const _ = require('lodash');
|
||
8 years ago
|
const is_service_enabled = require('../../../../controller/predicates/is_service_enabled');
|
||
8 years ago
|
|
||
|
module.exports.tests = {};
|
||
|
|
||
|
module.exports.tests.interface = (test, common) => {
|
||
|
test('valid interface', (t) => {
|
||
8 years ago
|
t.equal(typeof is_service_enabled, 'function', 'is_service_enabled is a function');
|
||
|
t.equal(typeof is_service_enabled(), 'function', 'is_service_enabled() is a function');
|
||
8 years ago
|
t.end();
|
||
|
});
|
||
|
};
|
||
|
|
||
|
module.exports.tests.true_conditions = (test, common) => {
|
||
|
test('string uri should return true', (t) => {
|
||
8 years ago
|
t.ok(is_service_enabled('pip uri')());
|
||
8 years ago
|
t.end();
|
||
|
|
||
|
});
|
||
|
|
||
|
};
|
||
|
|
||
|
module.exports.tests.false_conditions = (test, common) => {
|
||
|
test('undefined uri should return false', (t) => {
|
||
8 years ago
|
t.notOk(is_service_enabled()());
|
||
8 years ago
|
t.end();
|
||
|
|
||
|
});
|
||
|
|
||
|
};
|
||
|
|
||
|
module.exports.all = (tape, common) => {
|
||
|
function test(name, testFunction) {
|
||
8 years ago
|
return tape(`GET /is_service_enabled ${name}`, testFunction);
|
||
8 years ago
|
}
|
||
|
|
||
|
for( const testCase in module.exports.tests ){
|
||
|
module.exports.tests[testCase](test, common);
|
||
|
}
|
||
|
};
|