@@ -147,12 +147,13 @@ describe('WebhookController', () => {
147
147
) ;
148
148
149
149
expect ( mockResponse . status ) . toHaveBeenCalledWith ( 400 ) ;
150
- expect ( mockResponse . json ) . toHaveBeenCalledWith ( {
151
- success : true ,
152
- message : 'Sentry 웹훅 처리에 실패했습니다' ,
153
- data : { } ,
154
- error : null
155
- } ) ;
150
+ expect ( mockResponse . json ) . toHaveBeenCalledWith (
151
+ expect . objectContaining ( {
152
+ message : 'Sentry 웹훅 처리에 실패했습니다' ,
153
+ statusCode : 400 ,
154
+ code : 'INVALID_SYNTAX'
155
+ } )
156
+ ) ;
156
157
expect ( nextFunction ) . not . toHaveBeenCalled ( ) ;
157
158
} ) ;
158
159
@@ -166,12 +167,13 @@ describe('WebhookController', () => {
166
167
) ;
167
168
168
169
expect ( mockResponse . status ) . toHaveBeenCalledWith ( 400 ) ;
169
- expect ( mockResponse . json ) . toHaveBeenCalledWith ( {
170
- success : true ,
171
- message : 'Sentry 웹훅 처리에 실패했습니다' ,
172
- data : { } ,
173
- error : null
174
- } ) ;
170
+ expect ( mockResponse . json ) . toHaveBeenCalledWith (
171
+ expect . objectContaining ( {
172
+ message : 'Sentry 웹훅 처리에 실패했습니다' ,
173
+ statusCode : 400 ,
174
+ code : 'INVALID_SYNTAX'
175
+ } )
176
+ ) ;
175
177
} ) ;
176
178
177
179
it ( 'action이 없는 경우 400 에러를 반환해야 한다' , async ( ) => {
@@ -184,12 +186,13 @@ describe('WebhookController', () => {
184
186
) ;
185
187
186
188
expect ( mockResponse . status ) . toHaveBeenCalledWith ( 400 ) ;
187
- expect ( mockResponse . json ) . toHaveBeenCalledWith ( {
188
- success : true ,
189
- message : 'Sentry 웹훅 처리에 실패했습니다' ,
190
- data : { } ,
191
- error : null
192
- } ) ;
189
+ expect ( mockResponse . json ) . toHaveBeenCalledWith (
190
+ expect . objectContaining ( {
191
+ message : 'Sentry 웹훅 처리에 실패했습니다' ,
192
+ statusCode : 400 ,
193
+ code : 'INVALID_SYNTAX'
194
+ } )
195
+ ) ;
193
196
} ) ;
194
197
195
198
it ( '전혀 다른 형태의 객체인 경우 400 에러를 반환해야 한다' , async ( ) => {
@@ -206,12 +209,13 @@ describe('WebhookController', () => {
206
209
) ;
207
210
208
211
expect ( mockResponse . status ) . toHaveBeenCalledWith ( 400 ) ;
209
- expect ( mockResponse . json ) . toHaveBeenCalledWith ( {
210
- success : true ,
211
- message : 'Sentry 웹훅 처리에 실패했습니다' ,
212
- data : { } ,
213
- error : null
214
- } ) ;
212
+ expect ( mockResponse . json ) . toHaveBeenCalledWith (
213
+ expect . objectContaining ( {
214
+ message : 'Sentry 웹훅 처리에 실패했습니다' ,
215
+ statusCode : 400 ,
216
+ code : 'INVALID_SYNTAX'
217
+ } )
218
+ ) ;
215
219
} ) ;
216
220
217
221
it ( 'action은 created이지만 필수 필드가 없는 경우 에러를 전달해야 한다' , async ( ) => {
@@ -232,7 +236,9 @@ describe('WebhookController', () => {
232
236
233
237
expect ( nextFunction ) . toHaveBeenCalledWith (
234
238
expect . objectContaining ( {
235
- message : 'Sentry 웹훅 데이터가 올바르지 않습니다'
239
+ message : 'Sentry 웹훅 처리에 실패했습니다' ,
240
+ statusCode : 400 ,
241
+ code : 'INVALID_SYNTAX'
236
242
} )
237
243
) ;
238
244
expect ( mockResponse . json ) . not . toHaveBeenCalled ( ) ;
0 commit comments