11import test from 'ava' ;
22import mongoose from 'mongoose' ;
3- import mms from 'mongodb-memory-server' ;
4- import nm from '.' ;
3+ import { MongoMemoryServer } from 'mongodb-memory-server' ;
4+ import nm from './index.js ' ;
55
66test ( 'Main' , async t => {
7- const mongodb = new mms ( ) ;
8- mongoose . connect ( await mongodb . getConnectionString ( ) , { useNewUrlParser : true } ) ;
7+ const mongodb = await MongoMemoryServer . create ( ) ;
8+ mongoose . connect ( mongodb . getUri ( ) , { useNewUrlParser : true } ) ;
99
1010 const personSchema = mongoose . Schema ( {
1111 name : String ,
1212 age : Number ,
1313 email : String ,
14- password : { type : String , private : true }
14+ password : { type : String , private : true } ,
1515 } ) ;
1616
1717 personSchema . plugin ( nm ) ;
@@ -24,7 +24,7 @@ test('Main', async t => {
2424 name : 'Abraham' ,
2525 age : 7 ,
2626 email : 'email@example.com' ,
27- password : 'my_awesome_password'
27+ password : 'my_awesome_password' ,
2828 } ) ;
2929
3030 someone . save ( ) ;
@@ -34,7 +34,7 @@ test('Main', async t => {
3434 const expected = {
3535 age : 7 ,
3636 email : 'email@example.com' ,
37- name : 'Abraham'
37+ name : 'Abraham' ,
3838 } ;
3939
4040 t . deepEqual ( result , { ...expected , id : result . id } ) ;
0 commit comments