Muthu Kumar
6 years ago
3 changed files with 38 additions and 0 deletions
@ -0,0 +1,19 @@ |
|||
const Mongoose = require("mongoose"); |
|||
|
|||
module.exports = context => { |
|||
const mongoose = new Mongoose.Mongoose(); |
|||
mongoose.connect( |
|||
context.connectionString, |
|||
{ useNewUrlParser: true } |
|||
); |
|||
const db = context.collections.reduce((dbObj, coll) => { |
|||
dbObj[coll] = mongoose.model(coll, |
|||
new mongoose.Schema({}, { strict: false })); |
|||
return dbObj; |
|||
}, {}); |
|||
|
|||
db.__mongoose__ = mongoose; |
|||
|
|||
return db; |
|||
|
|||
}; |
@ -0,0 +1,7 @@ |
|||
const request = require('./request'); |
|||
const db = require('./db'); |
|||
|
|||
module.exports = { |
|||
request, |
|||
db, |
|||
}; |
@ -0,0 +1,12 @@ |
|||
module.exports = context => { |
|||
|
|||
const chai = require('chai'); |
|||
const chaiHttp = require('chai-http'); |
|||
chai.use(chaiHttp); |
|||
const agent = ( |
|||
chai.request |
|||
.agent(context.baseUrl) |
|||
); |
|||
return agent; |
|||
|
|||
}; |
Loading…
Reference in new issue