@@ -18,6 +18,20 @@ jest.mock('@/configs/logger.config', () => ({
1818 info : jest . fn ( ) ,
1919} ) ) ;
2020
21+ // 환경변수 모킹 (AES 키 설정, 첫 메모리 로드될때 util 함수쪽 key 세팅 이슈 방지)
22+ process . env . AES_KEY_0 = 'a' . repeat ( 32 ) ;
23+ process . env . AES_KEY_1 = 'b' . repeat ( 32 ) ;
24+ process . env . AES_KEY_2 = 'c' . repeat ( 32 ) ;
25+ process . env . AES_KEY_3 = 'd' . repeat ( 32 ) ;
26+ process . env . AES_KEY_4 = 'e' . repeat ( 32 ) ;
27+ process . env . AES_KEY_5 = 'f' . repeat ( 32 ) ;
28+ process . env . AES_KEY_6 = 'g' . repeat ( 32 ) ;
29+ process . env . AES_KEY_7 = 'h' . repeat ( 32 ) ;
30+ process . env . AES_KEY_8 = 'i' . repeat ( 32 ) ;
31+ process . env . AES_KEY_9 = 'j' . repeat ( 32 ) ;
32+ process . env . NODE_ENV = 'test' ;
33+
34+
2135describe ( 'UserController' , ( ) => {
2236 let userController : UserController ;
2337 let mockUserService : jest . Mocked < UserService > ;
@@ -26,6 +40,8 @@ describe('UserController', () => {
2640 let nextFunction : jest . Mock ;
2741
2842 beforeEach ( ( ) => {
43+ process . env . NODE_ENV = 'development' ;
44+
2945 // UserService 모킹
3046 const userRepo = new UserRepository ( mockPool as unknown as Pool ) ;
3147 const serviceInstance = new UserService ( userRepo ) ;
@@ -52,9 +68,6 @@ describe('UserController', () => {
5268 } ;
5369
5470 nextFunction = jest . fn ( ) ;
55-
56- // 환경변수 모킹
57- process . env . NODE_ENV = 'development' ;
5871 } ) ;
5972
6073 afterEach ( ( ) => {
0 commit comments