mirror of
https://github.com/stolksdorf/homebrewery.git
synced 2026-01-11 06:49:16 +00:00
Both types of tests are now working
This commit is contained in:
@@ -84,15 +84,6 @@ const BrewData = {
|
||||
const newBrew = new Brew(brew);
|
||||
|
||||
return newBrew.save();
|
||||
|
||||
//TODO: add error decorators to the catches
|
||||
const temp = newBrew.save().then(()=>{
|
||||
console.log('SAVED');
|
||||
});
|
||||
|
||||
console.log(typeof temp, _.keys(temp), temp);
|
||||
|
||||
return temp;
|
||||
},
|
||||
update : (newBrew) => {
|
||||
return Brew.findOneAndUpdate({ editId : newBrew.editId },
|
||||
|
||||
@@ -6,13 +6,18 @@ const dbPath = process.env.MONGODB_URI || process.env.MONGOLAB_URI || 'mongodb:/
|
||||
module.exports = {
|
||||
connect : ()=>{
|
||||
return new Promise((resolve, reject)=>{
|
||||
mongoose.createConnection(dbPath,
|
||||
if(mongoose.connection.readyState == 1){
|
||||
console.log('already connected');
|
||||
return resolve();
|
||||
}
|
||||
mongoose.connect(dbPath,
|
||||
(err) => {
|
||||
if(err){
|
||||
console.log('Error : Could not connect to a Mongo Database.');
|
||||
console.log(' If you are running locally, make sure mongodb.exe is running.');
|
||||
return reject(err);
|
||||
}
|
||||
console.log('mongo connected.');
|
||||
return resolve();
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user