imf-data-nodejs-sdk
Version:
IMFData Cloudant Node.js SDK
109 lines (99 loc) • 3.5 kB
JavaScript
/**
* Copyright 2015 IBM Corp. All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var assert = require('assert');
function assertIMFDataPropsExist(module){
assertExists(module);
assertAccountModuleDbFunctionsExist(module.db);
assertExists(module.use);
assertExists(module.scope);
assertExists(module.request);
assertExists(module.relax);
assertExists(module.dinosaur);
assertExists(module.auth);
assertExists(module.ping);
assertExists(module.session);
assertExists(module.updates);
assertExists(module.follow_updates);
assertExists(module.config);
assertExists(module.generate_api_key);
assertExists(module.set_permissions);
assertExists(module.remove_permissions);
}
function assertAccountModuleDbFunctionsExist(db){
assertExists(db);
assertExists(db.create);
assertExists(db.get);
assertExists(db.destroy);
assertExists(db.list);
assertExists(db.use);
assertExists(db.scope);
assertExists(db.compact);
assertExists(db.replicate);
assertExists(db.changes);
assertExists(db.follow);
}
/**
* Checks not null or undefined
*/
function assertExists(thing) {
assert.notEqual(thing, null);
}
function assertIsNull(thing) {
assert.strictEqual(thing, null);
}
function assertDbModuleFunctionsExist(db_module){
assertExists(db_module);
assertExists(db_module.info);
assertExists(db_module.replicate);
assertExists(db_module.compact);
assertExists(db_module.changes);
assertExists(db_module.follow);
assertExists(db_module.auth);
assertExists(db_module.session);
assertExists(db_module.insert);
assertExists(db_module.get);
assertExists(db_module.head);
assertExists(db_module.copy);
assertExists(db_module.destroy);
assertExists(db_module.bulk);
assertExists(db_module.list);
assertExists(db_module.fetch);
assertExists(db_module.fetch_revs);
assertExists(db_module.config);
assertExists(db_module.show);
assertExists(db_module.atomic);
assertExists(db_module.updateWithHandler);
assertExists(db_module.view);
assertExists(db_module.view_with_list);
assertExists(db_module.spatial);
assertExists(db_module.search);
assertExists(db_module.view.compact);
assertExists(db_module.index);
assertExists(db_module.index.del);
assertExists(db_module.find);
assertExists(db_module.attachment);
assertExists(db_module.attachment.insert);
assertExists(db_module.attachment.get);
assertExists(db_module.attachment.destroy);
assertExists(db_module.multipart);
assertExists(db_module.multipart.insert);
assertExists(db_module.multipart.get);
}
exports.assertIMFDataPropsExist = assertIMFDataPropsExist;
exports.assertAccountModuleDbFunctionsExist = assertAccountModuleDbFunctionsExist;
exports.assertExists = assertExists;
exports.assertIsNull = assertIsNull;
exports.assertDbModuleFunctionsExist = assertDbModuleFunctionsExist;