Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var error;
var schema = new Schema({
description: {type: String, required: true}
});
var Breakfast = db.model('breakfast', schema, getCollectionName());
var goodBreakfast = new Breakfast({description: 'eggs & bacon'});
try {
yield goodBreakfast.save();
} catch (e) {
error = e;
}
assert.ifError(error);
var result;
try {
result = yield Breakfast.findOne().exec();
} catch (e) {
error = e;
}
assert.ifError(error);
assert.equal(result.description, 'eggs & bacon');
// Should cause a validation error because `description` is required
var badBreakfast = new Breakfast({});
try {
yield badBreakfast.save();
} catch (e) {
error = e;
}
console.log = (message) => {
assert.ifError('Should not be reached here');
};
const responseStream = clients.one.query(opts, function (err) {
assert.ifError(err)
})
responseStream.on('data', function (data) {