@@ -104,7 +104,7 @@ describe('FeedBackUtility Tests', () => {
104104
105105 it ( 'should throw an error when endpoint is not defined' , ( ) => {
106106 flagFeedbackEvent . endpoint = undefined ;
107- expect ( ( ) => flagFeedbackEvent . getUrl ( ) ) . toThrowError (
107+ expect ( ( ) => flagFeedbackEvent . getUrl ( ) ) . toThrow (
108108 'Resource is not defined for the FeedBack Object.' ,
109109 ) ;
110110 } ) ;
@@ -130,7 +130,7 @@ describe('FeedBackUtility Tests', () => {
130130
131131 it . skip ( 'should handle errors when sending a request using sendRequest function' , async ( ) => {
132132 client . post . mockRejectedValue ( new Error ( 'Mocked API Error' ) ) ;
133- await expect ( sendRequest ( flagFeedbackEvent ) ) . rejects . toThrowError ( 'Mocked API Error' ) ;
133+ await expect ( sendRequest ( flagFeedbackEvent ) ) . rejects . toThrow ( 'Mocked API Error' ) ;
134134 expect ( client . post ) . toHaveBeenCalledWith (
135135 flagFeedbackEvent . getUrl ( ) ,
136136 flagFeedbackEvent . getData ( ) ,
@@ -160,7 +160,7 @@ describe('FeedBackUtility Tests', () => {
160160
161161 it ( 'should throw an error when endpoint is not defined' , ( ) => {
162162 recommendationsEvent . endpoint = undefined ;
163- expect ( ( ) => recommendationsEvent . getUrl ( ) ) . toThrowError (
163+ expect ( ( ) => recommendationsEvent . getUrl ( ) ) . toThrow (
164164 'Resource is not defined for the FeedBack Object.' ,
165165 ) ;
166166 } ) ;
@@ -219,7 +219,7 @@ describe('FeedBackUtility Tests', () => {
219219 recommendationsEvent = setupRecommendationsEvent ( {
220220 method : 'post' ,
221221 } ) ;
222- await expect ( sendRequest ( recommendationsEvent ) ) . rejects . toThrowError ( 'Mocked API Error' ) ;
222+ await expect ( sendRequest ( recommendationsEvent ) ) . rejects . toThrow ( 'Mocked API Error' ) ;
223223 expect ( client . post ) . toHaveBeenCalledWith (
224224 recommendationsEvent . getUrl ( ) ,
225225 recommendationsEvent . getData ( ) ,
@@ -232,7 +232,7 @@ describe('FeedBackUtility Tests', () => {
232232 method : 'put' ,
233233 eventId : uuidv4 ( ) ,
234234 } ) ;
235- await expect ( sendRequest ( recommendationsEvent ) ) . rejects . toThrowError ( 'Mocked API Error' ) ;
235+ await expect ( sendRequest ( recommendationsEvent ) ) . rejects . toThrow ( 'Mocked API Error' ) ;
236236 expect ( client . put ) . toHaveBeenCalledWith (
237237 recommendationsEvent . getUrl ( ) ,
238238 recommendationsEvent . getData ( ) ,
@@ -245,7 +245,7 @@ describe('FeedBackUtility Tests', () => {
245245 method : 'patch' ,
246246 eventId : uuidv4 ( ) ,
247247 } ) ;
248- await expect ( sendRequest ( recommendationsEvent ) ) . rejects . toThrowError ( 'Mocked API Error' ) ;
248+ await expect ( sendRequest ( recommendationsEvent ) ) . rejects . toThrow ( 'Mocked API Error' ) ;
249249 expect ( client . patch ) . toHaveBeenCalledWith (
250250 recommendationsEvent . getUrl ( ) ,
251251 recommendationsEvent . getData ( ) ,
@@ -257,7 +257,7 @@ describe('FeedBackUtility Tests', () => {
257257 method : 'delete' ,
258258 eventId : uuidv4 ( ) ,
259259 } ) ;
260- await expect ( sendRequest ( recommendationsEvent ) ) . rejects . toThrowError (
260+ await expect ( sendRequest ( recommendationsEvent ) ) . rejects . toThrow (
261261 'Unsupported HTTP method: delete' ,
262262 ) ;
263263 } ) ;
@@ -267,7 +267,7 @@ describe('FeedBackUtility Tests', () => {
267267 method : 'get' ,
268268 eventId : uuidv4 ( ) ,
269269 } ) ;
270- await expect ( sendRequest ( recommendationsEvent ) ) . rejects . toThrowError (
270+ await expect ( sendRequest ( recommendationsEvent ) ) . rejects . toThrow (
271271 'Unsupported HTTP method: get' ,
272272 ) ;
273273 } ) ;
@@ -295,7 +295,7 @@ describe('FeedBackUtility Tests', () => {
295295 dataOverride : null ,
296296 override : true ,
297297 } ) ,
298- ) . toThrowError ( 'The data property cannot be null or undefined' ) ;
298+ ) . toThrow ( 'The data property cannot be null or undefined' ) ;
299299 } ) ;
300300
301301 it ( 'should throw an error when data is an array but method is not a POST' , ( ) => {
@@ -307,7 +307,7 @@ describe('FeedBackUtility Tests', () => {
307307 override : true ,
308308 eventId : uuidv4 ( ) ,
309309 } ) ,
310- ) . toThrowError ( "Array 'data' is only allowed for 'post' requests" ) ;
310+ ) . toThrow ( "Array 'data' is only allowed for 'post' requests" ) ;
311311 } ) ;
312312
313313 it ( 'should throw an error when data is an empty array and method is a POST' , ( ) => {
@@ -318,7 +318,7 @@ describe('FeedBackUtility Tests', () => {
318318 dataOverride : [ ] ,
319319 override : true ,
320320 } ) ,
321- ) . toThrowError ( "The 'data' array cannot be empty" ) ;
321+ ) . toThrow ( "The 'data' array cannot be empty" ) ;
322322 } ) ;
323323
324324 it ( 'should throw an error when data is any of any type other than array or object' , ( ) => {
@@ -329,7 +329,7 @@ describe('FeedBackUtility Tests', () => {
329329 dataOverride : 'invalid data type' ,
330330 override : true ,
331331 } ) ,
332- ) . toThrowError ( "The 'data' must be either a non-null object or an array of objects" ) ;
332+ ) . toThrow ( "The 'data' must be either a non-null object or an array of objects" ) ;
333333 } ) ;
334334
335335 it ( 'should throw an error when submitted data has missing fields' , ( ) => {
@@ -340,7 +340,7 @@ describe('FeedBackUtility Tests', () => {
340340 dataOverride : { } ,
341341 override : true ,
342342 } ) ,
343- ) . toThrowError ( / T h e ' d a t a ' o b j e c t i s m i s s i n g r e q u i r e d p r o p e r t y : \w + / ) ;
343+ ) . toThrow ( / T h e ' d a t a ' o b j e c t i s m i s s i n g r e q u i r e d p r o p e r t y : \w + / ) ;
344344 } ) ;
345345
346346 it ( 'should throw an error when submitted data array has invalid data' , ( ) => {
@@ -351,7 +351,7 @@ describe('FeedBackUtility Tests', () => {
351351 dataOverride : [ null ] ,
352352 override : true ,
353353 } ) ,
354- ) . toThrowError ( / I t e m a t p o s i t i o n \w + i n ' d a t a ' i s n o t a v a l i d o b j e c t / ) ;
354+ ) . toThrow ( / I t e m a t p o s i t i o n \w + i n ' d a t a ' i s n o t a v a l i d o b j e c t / ) ;
355355 } ) ;
356356
357357 it ( 'should throw an error when submitted data array has valid data but with missing fields' , ( ) => {
@@ -362,12 +362,12 @@ describe('FeedBackUtility Tests', () => {
362362 dataOverride : [ { } ] ,
363363 override : true ,
364364 } ) ,
365- ) . toThrowError ( / M i s s i n g r e q u i r e d p r o p e r t y i n ' d a t a ' : \w + a t p o s i t i o n : \w + / ) ;
365+ ) . toThrow ( / M i s s i n g r e q u i r e d p r o p e r t y i n ' d a t a ' : \w + a t p o s i t i o n : \w + / ) ;
366366 } ) ;
367367
368368 it ( 'should throw an error when endpoint is not defined' , ( ) => {
369369 recommendationsInteractionEvent . endpoint = undefined ;
370- expect ( ( ) => recommendationsInteractionEvent . getUrl ( ) ) . toThrowError (
370+ expect ( ( ) => recommendationsInteractionEvent . getUrl ( ) ) . toThrow (
371371 'Resource is not defined for the FeedBack Object.' ,
372372 ) ;
373373 } ) ;
@@ -440,7 +440,7 @@ describe('FeedBackUtility Tests', () => {
440440 recommendationsInteractionEvent = setupRecommendationsInteractionEvent ( {
441441 method : 'post' ,
442442 } ) ;
443- await expect ( sendRequest ( recommendationsInteractionEvent ) ) . rejects . toThrowError (
443+ await expect ( sendRequest ( recommendationsInteractionEvent ) ) . rejects . toThrow (
444444 'Mocked API Error' ,
445445 ) ;
446446 expect ( client . post ) . toHaveBeenCalledWith (
@@ -455,7 +455,7 @@ describe('FeedBackUtility Tests', () => {
455455 method : 'put' ,
456456 eventId : uuidv4 ( ) ,
457457 } ) ;
458- await expect ( sendRequest ( recommendationsInteractionEvent ) ) . rejects . toThrowError (
458+ await expect ( sendRequest ( recommendationsInteractionEvent ) ) . rejects . toThrow (
459459 'Mocked API Error' ,
460460 ) ;
461461 expect ( client . put ) . toHaveBeenCalledWith (
@@ -470,7 +470,7 @@ describe('FeedBackUtility Tests', () => {
470470 method : 'patch' ,
471471 eventId : uuidv4 ( ) ,
472472 } ) ;
473- await expect ( sendRequest ( recommendationsInteractionEvent ) ) . rejects . toThrowError (
473+ await expect ( sendRequest ( recommendationsInteractionEvent ) ) . rejects . toThrow (
474474 'Mocked API Error' ,
475475 ) ;
476476 expect ( client . patch ) . toHaveBeenCalledWith (
@@ -483,7 +483,7 @@ describe('FeedBackUtility Tests', () => {
483483 recommendationsInteractionEvent = setupRecommendationsInteractionEvent ( {
484484 method : 'delete' ,
485485 } ) ;
486- await expect ( sendRequest ( recommendationsInteractionEvent ) ) . rejects . toThrowError (
486+ await expect ( sendRequest ( recommendationsInteractionEvent ) ) . rejects . toThrow (
487487 'Unsupported HTTP method: delete' ,
488488 ) ;
489489 } ) ;
@@ -493,7 +493,7 @@ describe('FeedBackUtility Tests', () => {
493493 method : 'get' ,
494494 id : uuidv4 ( ) ,
495495 } ) ;
496- await expect ( sendRequest ( recommendationsInteractionEvent ) ) . rejects . toThrowError (
496+ await expect ( sendRequest ( recommendationsInteractionEvent ) ) . rejects . toThrow (
497497 'Unsupported HTTP method: get' ,
498498 ) ;
499499 } ) ;
0 commit comments