Skip to content
This repository has been archived by the owner on Jun 7, 2022. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/master' into greenkeeper/initial
Browse files Browse the repository at this point in the history
  • Loading branch information
Christophe Braud committed Jan 4, 2018
2 parents 5384857 + 3ff07c0 commit 69b5d79
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
}
},
"scripts": {
"cover": "istanbul cover _mocha \"./test/**/!(index).js\" -- --exit",
"cover": "istanbul --include-all-sources cover _mocha \"./test/**/!(index).js\" -- --exit",
"coveralls": "npm run cover -- --report lcovonly && cat ./coverage/lcov.info | coveralls",
"depcheck": "depcheck --ignores=path,mocha-lcov-reporter",
"lint": "./node_modules/eslint/bin/eslint.js --cache lib/** test/**",
Expand Down
6 changes: 5 additions & 1 deletion test/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ module.exports = {
version: '1.0.0',
description: 'API de test manuel du service docs !',
base_url: 'http://localhost:3000',
mongoURI: 'mongodb://localhost:27017/relationships',
mongo: {
host: 'localhost',
port: 27017,
name: 'relatioships'
},
license: {
name: 'MIT',
url: 'https://opensource.org/licenses/mit-license.php'
Expand Down
6 changes: 5 additions & 1 deletion test/config/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ module.exports = {
version: '1.0.0',
description: 'API de test avec les pizzas Arezzo !',
base_url: 'http://localhost:3000',
mongoURI: 'mongodb://localhost:27017/relationships',
mongo: {
host: 'localhost',
port: 27017,
name: 'relationships'
},
license: {
name: 'MIT',
url: 'https://opensource.org/licenses/mit-license.php'
Expand Down
8 changes: 5 additions & 3 deletions test/docs-owner.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ process.env.NODE_CONFIG_DIR = './test/config';
process.env.NODE_ENV = 'test';

//Require the dev-dependencies
const {MongoClient} = require('mongodb');
const {MongoClient, Server} = require('mongodb');
const debug = require('debug')('campsi:test');
const chai = require('chai');
const chaiHttp = require('chai-http');
Expand Down Expand Up @@ -56,9 +56,11 @@ describe('Docs - Owner', () => {
beforeEach((done) => {

// Empty the database
MongoClient.connect(config.campsi.mongoURI).then((db) => {
let client = new MongoClient(new Server(config.campsi.mongo.host, config.campsi.mongo.port));
client.connect((error, mongoClient) => {
let db = mongoClient.db(config.campsi.mongo.name);
db.dropDatabase(() => {
db.close();
client.close();
campsi = new CampsiServer(config.campsi);
campsi.mount('docs', new services.Docs(config.services.docs));
campsi.app.use((req, res, next) => {
Expand Down
8 changes: 5 additions & 3 deletions test/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ process.env.NODE_CONFIG_DIR = './test/config';
process.env.NODE_ENV = 'test';

//Require the dev-dependencies
const {MongoClient} = require('mongodb');
const {MongoClient, Server} = require('mongodb');
const debug = require('debug')('campsi:test');
const async = require('async');
const chai = require('chai');
Expand Down Expand Up @@ -47,9 +47,11 @@ describe('Docs', () => {
beforeEach((done) => {

// Empty the database
MongoClient.connect(config.campsi.mongoURI).then((db) => {
let client = new MongoClient(new Server(config.campsi.mongo.host, config.campsi.mongo.port));
client.connect((error, mongoClient) => {
let db = mongoClient.db(config.campsi.mongo.name);
db.dropDatabase(() => {
db.close();
client.close();
campsi = new CampsiServer(config.campsi);
campsi.mount('docs', new services.Docs(config.services.docs));

Expand Down

0 comments on commit 69b5d79

Please sign in to comment.