File tree Expand file tree Collapse file tree 5 files changed +18
-7
lines changed Expand file tree Collapse file tree 5 files changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,10 @@ import dotenv from "dotenv";
3
3
4
4
dotenv . config ( ) ;
5
5
6
- const REDIS_URI = process . env . REDIS_URI || "redis://localhost:6379" ;
6
+ const REDIS_URI =
7
+ process . env . NODE_ENV === "test"
8
+ ? process . env . REDIS_URI_TEST
9
+ : process . env . REDIS_URI || "redis://localhost:6379" ;
7
10
8
11
const client = createClient ( { url : REDIS_URI } ) ;
9
12
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ export async function createUser(
31
31
email,
32
32
password,
33
33
isAdmin,
34
+ isVerified,
34
35
} ) ;
35
36
return user . save ( ) ;
36
37
}
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ export async function seedAdminAccount() {
38
38
adminUsername ,
39
39
adminEmail ,
40
40
hashedPassword ,
41
+ true ,
41
42
true
42
43
) ;
43
44
console . log ( "Admin account created successfully." ) ;
Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ import supertest from "supertest";
4
4
import app from "../app" ;
5
5
import UserModel from "../model/user-model" ;
6
6
7
+ jest . setTimeout ( 10000 ) ;
8
+
7
9
const request = supertest ( app ) ;
8
10
9
11
const AUTH_BASE_URL = "/api/auth" ;
@@ -25,6 +27,7 @@ const insertAdminUser = async () => {
25
27
email,
26
28
password : hashedPassword ,
27
29
isAdmin : true ,
30
+ isVerified : true ,
28
31
} ) . save ( ) ;
29
32
30
33
return { email, password } ;
@@ -37,6 +40,7 @@ const insertNonAdminUser = async () => {
37
40
lastName,
38
41
email,
39
42
password : hashedPassword ,
43
+ isVerified : true ,
40
44
} ) . save ( ) ;
41
45
42
46
return { email, password } ;
Original file line number Diff line number Diff line change
1
+ name : peerprep-test
2
+
1
3
services :
2
4
test-user-service :
3
5
image : peerprep/user-service
4
6
build : ./backend/user-service
5
7
env_file : ./backend/user-service/.env
6
8
environment :
7
- - MONGO_URI_TEST=mongodb://mongo:mongo@mongo:27017/
9
+ - MONGO_URI_TEST=mongodb://mongo:mongo@test- mongo:27017/
8
10
depends_on :
9
- - mongo
10
- - redis
11
+ - test- mongo
12
+ - test- redis
11
13
networks :
12
14
- peerprep-network
13
15
volumes :
@@ -16,17 +18,17 @@ services:
16
18
restart : on-failure
17
19
command : ["npm", "test"]
18
20
19
- mongo :
21
+ test- mongo :
20
22
image : mongo
21
23
restart : always
22
24
networks :
23
25
- peerprep-network
24
26
env_file :
25
27
- ./backend/.env
26
28
27
- redis :
29
+ test- redis :
28
30
image : redis:8.0-M01
29
- container_name : redis
31
+ container_name : test- redis
30
32
networks :
31
33
- peerprep-network
32
34
healthcheck :
You can’t perform that action at this time.
0 commit comments