var schemas = require('../../../helper/labelSchema.json'); var alpha3 = require('../mock/alpha3.json'); module.exports.tests = {}; module.exports.tests.interface = function(test, common) { test('interface', function(t) { t.equal(typeof schemas, 'object', 'valid object'); t.equal(schemas.hasOwnProperty('default'), true, 'has default defined'); t.end(); }); }; module.exports.tests.valid = function(test, common) { var valid_keys = ['localadmin', 'locality', 'neighbourhood', 'county', 'region_a', 'region', 'country']; var default_schema = { local: ['localadmin', 'locality', 'neighbourhood', 'county', 'region'], regional: ['country'] }; var isValid = function(keys, schema) { test('valid key/object (' + keys + ')' , function(t) { if (keys === 'default') { t.deepEqual(schema, default_schema, 'valid default schema'); } else { t.equal(alpha3.hasOwnProperty(keys), true, 'valid key'); } t.equal(typeof schema, 'object', 'valid object'); t.notEqual(Object.getOwnPropertyNames(schema).length, 0, 'object not empty'); for (var levels in schema) { t.equal(Object.prototype.toString.call(schema[levels]), '[object Array]', levels+' is an array'); for (var i=0;i