samedi 10 novembre 2018

testing ibm_db2 with sinon/mocha/chai

I am trying to write sinon test case for ibm_db2 in my node js app. My node js code to connect to db looks like this. Can anyone suggest a way to mock this using sinon/mocha test scripts.

var db = require(ibm_db);
var config={};//All db params are in config
var connection = db.openSync(config);
function getConnection(){
if(connection == null || connection == undefined){
connection = db.openSync(config);
}
return connection.
}
exports.getConnection = getConnection;

Aucun commentaire:

Enregistrer un commentaire