From 0863d20dfe9c8d3dfa4eb2ad3d0d976acf83fe1d Mon Sep 17 00:00:00 2001 From: Paul Neubauer Date: Thu, 9 Mar 2023 12:50:09 +0100 Subject: [PATCH] Fix unittest --- .../web-app-files/tests/unit/helpers/share/link.spec.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/web-app-files/tests/unit/helpers/share/link.spec.ts b/packages/web-app-files/tests/unit/helpers/share/link.spec.ts index 701ef7ee233..51a0890e8b8 100644 --- a/packages/web-app-files/tests/unit/helpers/share/link.spec.ts +++ b/packages/web-app-files/tests/unit/helpers/share/link.spec.ts @@ -38,6 +38,13 @@ const mockResource = { const getAbilityMock = (hasPermission) => mock({ can: () => hasPermission }) +let returnBitmask = 1 +jest.mock('web-client/src/helpers/share', () => ({ + LinkShareRoles: { + getByName: jest.fn().mockReturnValue({ bitmask: jest.fn(() => returnBitmask) }) + } +})) + describe('createQuicklink', () => { it('should create a quicklink with the correct parameters', async () => { const args: CreateQuicklink = { @@ -77,6 +84,7 @@ describe('createQuicklink', () => { it.each(['viewer', 'internal'])( 'should create a quicklink without a password if no password is provided and capabilities set to default %s', async (role) => { + returnBitmask = role === 'viewer' ? 1 : 0 mockStore.state.user.capabilities.files_sharing.quickLink.default_role = role const args: CreateQuicklink = {