Skip to content

Commit

Permalink
Merge pull request #10 from rimiti/update-dependencies
Browse files Browse the repository at this point in the history
Update dependencies
  • Loading branch information
rimiti authored Jan 8, 2018
2 parents 27b6457 + 0be0fa1 commit 9f10fb4
Show file tree
Hide file tree
Showing 3 changed files with 986 additions and 958 deletions.
11 changes: 6 additions & 5 deletions __tests__/tests.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow
import Redis from 'redis';
import MongoDB from 'mongodb';
import {MongoClient} from 'mongodb';
import Sequelize from 'sequelize';
import Acl from '../src/classes/acl';
import MemoryStore from '../src/stores/memory';
Expand All @@ -9,10 +9,10 @@ import MongoDBStore from '../src/stores/mongodb';
import SequelizeStore from '../src/stores/sequelize';

jest.setTimeout(10000);
let mongoClient = null;

['Memory', 'MySQL', 'Redis', 'MongoDB'].forEach((store) => {
let acl = null;

describe(store, () => {
beforeAll((done) => {
if (store === 'Memory') {
Expand All @@ -22,8 +22,9 @@ jest.setTimeout(10000);
acl = new Acl(new RedisStore(Redis.createClient({host: 'redis'})));
done();
} else if (store === 'MongoDB') {
MongoDB.connect('mongodb://mongo/aclify', (error, db) => {
acl = new Acl(new MongoDBStore(db, 'acl_'));
MongoClient.connect('mongodb://mongo', (err, client) => {
acl = new Acl(new MongoDBStore(client.db('aclify'), 'acl_'));
mongoClient = client;
done();
});
} else if (store === 'MySQL') {
Expand All @@ -44,7 +45,7 @@ jest.setTimeout(10000);
afterAll((done) => {
setTimeout(() => {
if (store === 'Redis') acl.store.redis.quit();
else if (store === 'MongoDB') acl.store.db.close();
else if (store === 'MongoDB') mongoClient.close();
else if (store === 'MySQL') acl.store.db.close();
done();
}, 5000);
Expand Down
Loading

0 comments on commit 9f10fb4

Please sign in to comment.