@@ -46,10 +46,6 @@ describe('elements/content-sharing/sharingService', () => {
4646 } ) ;
4747
4848 test ( 'should call updateSharedLink with correct parameters when changeSharedLinkPermission is called' , async ( ) => {
49- mockItemApiInstance . updateSharedLink . mockImplementation ( ( _options , _access , successCallback ) => {
50- successCallback ( { id : '123' , shared_link : null } ) ;
51- } ) ;
52-
5349 const service = createSharingServiceWrapper ( ) ;
5450 const permissionLevel = PERMISSION_CAN_DOWNLOAD ;
5551 const expectedPermissions = {
@@ -62,8 +58,8 @@ describe('elements/content-sharing/sharingService', () => {
6258 expect ( mockItemApiInstance . updateSharedLink ) . toHaveBeenCalledWith (
6359 options ,
6460 { permissions : expectedPermissions } ,
65- expect . any ( Function ) ,
66- expect . any ( Function ) ,
61+ mockOnUpdateSharedLink ,
62+ { } ,
6763 CONTENT_SHARING_SHARED_LINK_UPDATE_PARAMS ,
6864 ) ;
6965 } ) ;
@@ -79,18 +75,14 @@ describe('elements/content-sharing/sharingService', () => {
7975 test . each ( [ 'open' , 'company' , 'collaborators' ] ) (
8076 'should call share with correct parameters when changeSharedLinkAccess is called' ,
8177 async access => {
82- mockItemApiInstance . share . mockImplementation ( ( _options , _access , successCallback ) => {
83- successCallback ( { id : '123' , shared_link : null } ) ;
84- } ) ;
85-
8678 const service = createSharingServiceWrapper ( ) ;
8779 await service . changeSharedLinkAccess ( access ) ;
8880
8981 expect ( mockItemApiInstance . share ) . toHaveBeenCalledWith (
9082 options ,
9183 access ,
92- expect . any ( Function ) ,
93- expect . any ( Function ) ,
84+ mockOnUpdateSharedLink ,
85+ { } ,
9486 CONTENT_SHARING_SHARED_LINK_UPDATE_PARAMS ,
9587 ) ;
9688 } ,
@@ -269,28 +261,6 @@ describe('elements/content-sharing/sharingService', () => {
269261 } ) ;
270262
271263 describe ( 'error handling' , ( ) => {
272- test ( 'should reject when changeSharedLinkAccess fails' , async ( ) => {
273- const mockError = new Error ( 'Failed to change access' ) ;
274- mockItemApiInstance . share . mockImplementation ( ( _options , _access , _successCallback , errorCallback ) => {
275- errorCallback ( mockError ) ;
276- } ) ;
277-
278- const service = createSharingServiceWrapper ( ) ;
279- await expect ( service . changeSharedLinkAccess ( 'open' ) ) . rejects . toEqual ( mockError ) ;
280- } ) ;
281-
282- test ( 'should reject when changeSharedLinkPermission fails' , async ( ) => {
283- const mockError = new Error ( 'Failed to change permission' ) ;
284- mockItemApiInstance . updateSharedLink . mockImplementation (
285- ( _options , _settings , _successCallback , errorCallback ) => {
286- errorCallback ( mockError ) ;
287- } ,
288- ) ;
289-
290- const service = createSharingServiceWrapper ( ) ;
291- await expect ( service . changeSharedLinkPermission ( PERMISSION_CAN_DOWNLOAD ) ) . rejects . toEqual ( mockError ) ;
292- } ) ;
293-
294264 test ( 'should reject when createSharedLink fails' , async ( ) => {
295265 const mockError = new Error ( 'Failed to create shared link' ) ;
296266 mockItemApiInstance . share . mockImplementation ( ( _options , _access , _successCallback , errorCallback ) => {
0 commit comments