15
15
const { assert } = require ( 'chai' ) ;
16
16
const { MongooseAdapter } = require ( '../../lib/cjs' ) ;
17
17
18
- const MONGOOSE_OPTIONS = { useNewUrlParser : true , useCreateIndex : true , useUnifiedTopology : true } ;
19
-
20
18
describe ( 'MongooseAdapter' , ( ) => {
21
19
it ( 'Should properly throw error if Mongo URI is not provided' , async ( ) => {
22
20
assert . throws ( ( ) => new MongooseAdapter ( ) , 'You must provide Mongo URI to connect to!' ) ;
23
21
} ) ;
24
22
25
23
it ( 'Should properly instantiate adapter' , async ( ) => {
26
- const adapter = new MongooseAdapter ( 'mongodb://localhost:27001/casbin' , MONGOOSE_OPTIONS ) ;
24
+ const adapter = new MongooseAdapter ( 'mongodb://localhost:27001/casbin' ) ;
27
25
28
26
assert . instanceOf ( adapter , MongooseAdapter ) ;
29
27
assert . isFalse ( adapter . isFiltered ( ) ) ;
@@ -32,7 +30,7 @@ describe('MongooseAdapter', () => {
32
30
} ) ;
33
31
34
32
it ( 'Should properly create new instance via static newAdapter' , async ( ) => {
35
- const adapter = await MongooseAdapter . newAdapter ( 'mongodb://localhost:27001,localhost:27002/casbin?replicaSet=rs0' , MONGOOSE_OPTIONS ) ;
33
+ const adapter = await MongooseAdapter . newAdapter ( 'mongodb://localhost:27001,localhost:27002/casbin?replicaSet=rs0' ) ;
36
34
37
35
assert . instanceOf ( adapter , MongooseAdapter ) ;
38
36
assert . isFalse ( adapter . isFiltered ( ) ) ;
@@ -41,7 +39,7 @@ describe('MongooseAdapter', () => {
41
39
} ) ;
42
40
43
41
it ( 'Should properly create filtered instance via static newFilteredAdapter' , async ( ) => {
44
- const adapter = await MongooseAdapter . newFilteredAdapter ( 'mongodb://localhost:27001,localhost:27002/casbin?replicaSet=rs0' , MONGOOSE_OPTIONS ) ;
42
+ const adapter = await MongooseAdapter . newFilteredAdapter ( 'mongodb://localhost:27001,localhost:27002/casbin?replicaSet=rs0' ) ;
45
43
46
44
assert . instanceOf ( adapter , MongooseAdapter ) ;
47
45
assert . isTrue ( adapter . isFiltered ( ) ) ;
@@ -50,7 +48,7 @@ describe('MongooseAdapter', () => {
50
48
} ) ;
51
49
52
50
it ( 'Should have implemented interface for casbin' , async ( ) => {
53
- const adapter = new MongooseAdapter ( 'mongodb://localhost:27001,localhost:27002/casbin?replicaSet=rs0' , MONGOOSE_OPTIONS ) ;
51
+ const adapter = new MongooseAdapter ( 'mongodb://localhost:27001,localhost:27002/casbin?replicaSet=rs0' ) ;
54
52
55
53
assert . isFunction ( MongooseAdapter . newAdapter ) ;
56
54
assert . isFunction ( MongooseAdapter . newFilteredAdapter ) ;
0 commit comments