@@ -384,7 +384,7 @@ describe('<Message /> component', () => {
384384 const muteUser = vi . fn ( ( ) => Promise . resolve ( ) ) ;
385385 const userMutedNotification = 'User muted!' ;
386386 const getMuteUserSuccessNotification = vi . fn ( ( ) => userMutedNotification ) ;
387- client . muteUser = muteUser as any ;
387+ vi . spyOn ( client , 'muteUser' ) . mockImplementation ( muteUser as any ) ;
388388 let context ;
389389
390390 await renderComponent ( {
@@ -412,7 +412,7 @@ describe('<Message /> component', () => {
412412 const client = await getTestClientWithUser ( alice ) ;
413413 const addSuccessSpy = vi . spyOn ( client . notifications , 'addSuccess' ) ;
414414 const muteUser = vi . fn ( ( ) => Promise . resolve ( ) ) ;
415- client . muteUser = muteUser as any ;
415+ vi . spyOn ( client , 'muteUser' ) . mockImplementation ( muteUser as any ) ;
416416 let context ;
417417
418418 await renderComponent ( {
@@ -441,7 +441,7 @@ describe('<Message /> component', () => {
441441 const muteUser = vi . fn ( ( ) => Promise . reject ( ) ) ;
442442 const userMutedFailNotification = 'User mute failed!' ;
443443 const getMuteUserErrorNotification = vi . fn ( ( ) => userMutedFailNotification ) ;
444- client . muteUser = muteUser as any ;
444+ vi . spyOn ( client , 'muteUser' ) . mockImplementation ( muteUser as any ) ;
445445 let context ;
446446
447447 await renderComponent ( {
@@ -470,7 +470,7 @@ describe('<Message /> component', () => {
470470 const addErrorSpy = vi . spyOn ( client . notifications , 'addError' ) ;
471471 const muteUser = vi . fn ( ( ) => Promise . reject ( ) ) ;
472472 const defaultFailNotification = 'Error muting a user ...' ;
473- client . muteUser = muteUser as any ;
473+ vi . spyOn ( client , 'muteUser' ) . mockImplementation ( muteUser as any ) ;
474474 let context ;
475475
476476 await renderComponent ( {
@@ -499,7 +499,7 @@ describe('<Message /> component', () => {
499499 const unmuteUser = vi . fn ( ( ) => Promise . resolve ( ) ) ;
500500 const userUnmutedNotification = 'User unmuted!' ;
501501 const getMuteUserSuccessNotification = vi . fn ( ( ) => userUnmutedNotification ) ;
502- client . unmuteUser = unmuteUser as any ;
502+ vi . spyOn ( client , 'unmuteUser' ) . mockImplementation ( unmuteUser as any ) ;
503503 let context ;
504504
505505 await renderComponent ( {
@@ -528,7 +528,7 @@ describe('<Message /> component', () => {
528528 const addSuccessSpy = vi . spyOn ( client . notifications , 'addSuccess' ) ;
529529 const unmuteUser = vi . fn ( ( ) => Promise . resolve ( ) ) ;
530530 const defaultSuccessNotification = '{{ user }} has been unmuted' ;
531- client . unmuteUser = unmuteUser as any ;
531+ vi . spyOn ( client , 'unmuteUser' ) . mockImplementation ( unmuteUser as any ) ;
532532 let context ;
533533
534534 await renderComponent ( {
@@ -557,7 +557,7 @@ describe('<Message /> component', () => {
557557 const unmuteUser = vi . fn ( ( ) => Promise . reject ( ) ) ;
558558 const userMutedFailNotification = 'User muted failed!' ;
559559 const getMuteUserErrorNotification = vi . fn ( ( ) => userMutedFailNotification ) ;
560- client . unmuteUser = unmuteUser as any ;
560+ vi . spyOn ( client , 'unmuteUser' ) . mockImplementation ( unmuteUser as any ) ;
561561 let context ;
562562
563563 await renderComponent ( {
@@ -586,7 +586,7 @@ describe('<Message /> component', () => {
586586 const addErrorSpy = vi . spyOn ( client . notifications , 'addError' ) ;
587587 const unmuteUser = vi . fn ( ( ) => Promise . reject ( ) ) ;
588588 const defaultFailNotification = 'Error unmuting a user ...' ;
589- client . unmuteUser = unmuteUser as any ;
589+ vi . spyOn ( client , 'unmuteUser' ) . mockImplementation ( unmuteUser as any ) ;
590590 let context ;
591591
592592 await renderComponent ( {
@@ -778,7 +778,7 @@ describe('<Message /> component', () => {
778778 const client = await getTestClientWithUser ( alice ) ;
779779 const addSuccessSpy = vi . spyOn ( client . notifications , 'addSuccess' ) ;
780780 const flagMessage = vi . fn ( ( ) => Promise . resolve ( ) ) ;
781- client . flagMessage = flagMessage as any ;
781+ vi . spyOn ( client , 'flagMessage' ) . mockImplementation ( flagMessage as any ) ;
782782 const messageFlaggedNotification = 'Message flagged!' ;
783783 const getFlagMessageSuccessNotification = vi . fn ( ( ) => messageFlaggedNotification ) ;
784784 let context ;
@@ -807,7 +807,7 @@ describe('<Message /> component', () => {
807807 const client = await getTestClientWithUser ( alice ) ;
808808 const addSuccessSpy = vi . spyOn ( client . notifications , 'addSuccess' ) ;
809809 const flagMessage = vi . fn ( ( ) => Promise . resolve ( ) ) ;
810- client . flagMessage = flagMessage as any ;
810+ vi . spyOn ( client , 'flagMessage' ) . mockImplementation ( flagMessage as any ) ;
811811 const defaultSuccessNotification = 'Message has been successfully flagged' ;
812812 let context ;
813813
@@ -834,7 +834,7 @@ describe('<Message /> component', () => {
834834 const client = await getTestClientWithUser ( alice ) ;
835835 const addErrorSpy = vi . spyOn ( client . notifications , 'addError' ) ;
836836 const flagMessage = vi . fn ( ( ) => Promise . reject ( ) ) ;
837- client . flagMessage = flagMessage as any ;
837+ vi . spyOn ( client , 'flagMessage' ) . mockImplementation ( flagMessage as any ) ;
838838 const messageFlagFailedNotification = 'Message flagged failed!' ;
839839 const getFlagMessageErrorNotification = vi . fn ( ( ) => messageFlagFailedNotification ) ;
840840 let context ;
@@ -863,7 +863,7 @@ describe('<Message /> component', () => {
863863 const client = await getTestClientWithUser ( alice ) ;
864864 const addErrorSpy = vi . spyOn ( client . notifications , 'addError' ) ;
865865 const flagMessage = vi . fn ( ( ) => Promise . reject ( ) ) ;
866- client . flagMessage = flagMessage as any ;
866+ vi . spyOn ( client , 'flagMessage' ) . mockImplementation ( flagMessage as any ) ;
867867 const defaultFlagMessageFailedNotification = 'Error adding flag' ;
868868 let context ;
869869
0 commit comments