Just as title, I want write unit test for a function in angular js. this function is insert data into Mongo db. The code is as following:
function addDatasource(brandId, data, callback) {
var payload = _.assign(data, {brandId:brandId});
mongo.db().collection('datasources').insert(payload, callback);
}
I think to test such code, I need to mock MongoDB. I searched internet but didnot find any. Anyone can help me with this?
Aucun commentaire:
Enregistrer un commentaire