@@ -13,10 +13,10 @@ const mockApi = {
1313 getFolderAPI : jest . fn ( ) ,
1414} ;
1515const mockSharingService = {
16- deleteSharedLink : jest . fn ( ) ,
16+ createSharedLink : jest . fn ( ) ,
1717 changeSharedLinkAccess : jest . fn ( ) ,
1818 changeSharedLinkPermission : jest . fn ( ) ,
19- createSharedLink : jest . fn ( ) ,
19+ deleteSharedLink : jest . fn ( ) ,
2020 updateSharedLink : jest . fn ( ) ,
2121} ;
2222
@@ -121,10 +121,8 @@ describe('elements/content-sharing/hooks/useSharingService', () => {
121121 expect ( result . current . sharingService ) . toBe ( mockSharingService ) ;
122122 expect ( createSharingService ) . toHaveBeenCalledWith ( {
123123 itemApiInstance : { } ,
124- onSuccess : {
125- handleRemoveSharedLinkSuccess : expect . any ( Function ) ,
126- handleUpdateSharedLinkSuccess : expect . any ( Function ) ,
127- } ,
124+ onUpdateSharedLink : expect . any ( Function ) ,
125+ onRemoveSharedLink : expect . any ( Function ) ,
128126 options : {
129127 access : mockSharedLink . access ,
130128 isDownloadAvailable : mockSharedLink . settings . isDownloadAvailable ,
@@ -139,9 +137,9 @@ describe('elements/content-sharing/hooks/useSharingService', () => {
139137 ( convertItemResponse as jest . Mock ) . mockReturnValue ( mockConvertedData ) ;
140138 renderHookWithProps ( ) ;
141139
142- // Get the onSuccess callbacks that were passed to mock createSharingService
143- const onSuccessCallbacks = ( createSharingService as jest . Mock ) . mock . calls [ 0 ] [ 0 ] . onSuccess ;
144- onSuccessCallbacks . handleUpdateSharedLinkSuccess ( mockConvertedData ) ;
140+ // Get the callbacks that were passed to mock createSharingService
141+ const createSharingServiceArgs = ( createSharingService as jest . Mock ) . mock . calls [ 0 ] [ 0 ] ;
142+ createSharingServiceArgs . onUpdateSharedLink ( mockConvertedData ) ;
145143
146144 expect ( convertItemResponse ) . toHaveBeenCalledWith ( mockConvertedData ) ;
147145 expect ( mockSetItem ) . toHaveBeenCalledTimes ( 1 ) ;
@@ -152,9 +150,9 @@ describe('elements/content-sharing/hooks/useSharingService', () => {
152150 ( convertItemResponse as jest . Mock ) . mockReturnValue ( mockConvertedData ) ;
153151 renderHookWithProps ( ) ;
154152
155- // Get the onSuccess callbacks that were passed to mock createSharingService
156- const onSuccessCallbacks = ( createSharingService as jest . Mock ) . mock . calls [ 0 ] [ 0 ] . onSuccess ;
157- onSuccessCallbacks . handleRemoveSharedLinkSuccess ( mockConvertedData ) ;
153+ // Get the callbacks that were passed to mock createSharingService
154+ const createSharingServiceArgs = ( createSharingService as jest . Mock ) . mock . calls [ 0 ] [ 0 ] ;
155+ createSharingServiceArgs . onRemoveSharedLink ( mockConvertedData ) ;
158156
159157 expect ( convertItemResponse ) . toHaveBeenCalledWith ( mockConvertedData ) ;
160158 expect ( mockSetItem ) . toHaveBeenCalledTimes ( 1 ) ;
@@ -175,10 +173,8 @@ describe('elements/content-sharing/hooks/useSharingService', () => {
175173 expect ( result . current . sharingService ) . toBe ( mockSharingService ) ;
176174 expect ( createSharingService ) . toHaveBeenCalledWith ( {
177175 itemApiInstance : { } ,
178- onSuccess : {
179- handleRemoveSharedLinkSuccess : expect . any ( Function ) ,
180- handleUpdateSharedLinkSuccess : expect . any ( Function ) ,
181- } ,
176+ onUpdateSharedLink : expect . any ( Function ) ,
177+ onRemoveSharedLink : expect . any ( Function ) ,
182178 options : {
183179 access : mockSharedLink . access ,
184180 isDownloadAvailable : mockSharedLink . settings . isDownloadAvailable ,
@@ -193,9 +189,9 @@ describe('elements/content-sharing/hooks/useSharingService', () => {
193189 ( convertItemResponse as jest . Mock ) . mockReturnValue ( mockConvertedData ) ;
194190 renderHookWithProps ( { itemType : TYPE_FOLDER } ) ;
195191
196- // Get the onSuccess callbacks that were passed to mock createSharingService
197- const onSuccessCallbacks = ( createSharingService as jest . Mock ) . mock . calls [ 0 ] [ 0 ] . onSuccess ;
198- onSuccessCallbacks . handleUpdateSharedLinkSuccess ( mockConvertedData ) ;
192+ // Get the callbacks that were passed to mock createSharingService
193+ const createSharingServiceArgs = ( createSharingService as jest . Mock ) . mock . calls [ 0 ] [ 0 ] ;
194+ createSharingServiceArgs . onUpdateSharedLink ( mockConvertedData ) ;
199195
200196 expect ( convertItemResponse ) . toHaveBeenCalledWith ( mockConvertedData ) ;
201197 expect ( mockSetItem ) . toHaveBeenCalledTimes ( 1 ) ;
@@ -206,9 +202,9 @@ describe('elements/content-sharing/hooks/useSharingService', () => {
206202 ( convertItemResponse as jest . Mock ) . mockReturnValue ( mockConvertedData ) ;
207203 renderHookWithProps ( { itemType : TYPE_FOLDER } ) ;
208204
209- // Get the onSuccess callbacks that were passed to mock createSharingService
210- const onSuccessCallbacks = ( createSharingService as jest . Mock ) . mock . calls [ 0 ] [ 0 ] . onSuccess ;
211- onSuccessCallbacks . handleRemoveSharedLinkSuccess ( mockConvertedData ) ;
205+ // Get the callbacks that were passed to mock createSharingService
206+ const createSharingServiceArgs = ( createSharingService as jest . Mock ) . mock . calls [ 0 ] [ 0 ] ;
207+ createSharingServiceArgs . onRemoveSharedLink ( mockConvertedData ) ;
212208
213209 expect ( convertItemResponse ) . toHaveBeenCalledWith ( mockConvertedData ) ;
214210 expect ( mockSetItem ) . toHaveBeenCalledTimes ( 1 ) ;
0 commit comments