@@ -6,7 +6,9 @@ require("dotenv").config();
66describe ( "INSERT" , ( ) => {
77 test ( "Should confirm mongodb works by adding a record" , async ( ) => {
88 console . log ( "Attempting to connect to database..." ) ;
9- await connect ( process . env . AUTH_API_MONGODB_URI ) ;
9+ await connect (
10+ "mongodb+srv://microapi:secret123@cluster0.japiw.mongodb.net/microapi?retryWrites=true&w=majority"
11+ ) ;
1012 const id = mongoose . Types . ObjectId ( ) ;
1113 const mockData = new IndexModel ( {
1214 _id : id ,
@@ -28,14 +30,18 @@ describe("INSERT", () => {
2830 test ( "Should return error for existing connections" , async ( ) => {
2931 console . log ( "Attempting to connect to database..." ) ;
3032 mongoose . connection . readyState = 1 ;
31- expect ( await connect ( process . env . AUTH_API_MONGODB_URI ) ) . toEqual (
32- Error ( "Connection already Established" )
33- ) ;
33+ expect (
34+ await connect (
35+ "mongodb+srv://microapi:secret123@cluster0.japiw.mongodb.net/microapi?retryWrites=true&w=majority"
36+ )
37+ ) . toEqual ( Error ( "Connection already Established" ) ) ;
3438 } ) ;
3539
3640 test ( "Should return error for non-existing connections on disconnec" , async ( ) => {
3741 console . log ( "Attempting to connect to database..." ) ;
38- await connect ( process . env . AUTH_API_MONGODB_URI ) ;
42+ await connect (
43+ "mongodb+srv://microapi:secret123@cluster0.japiw.mongodb.net/microapi?retryWrites=true&w=majority"
44+ ) ;
3945 mongoose . connection . readyState = 0 ;
4046 expect ( await disconnect ( ) ) . toEqual ( Error ( "No open connection(s)" ) ) ;
4147 } ) ;
0 commit comments