2023-10-23 14:37:51 +02:00
|
|
|
import { AccessCore, IAccessRepository } from '@app/domain';
|
2023-06-06 22:18:38 +02:00
|
|
|
|
2023-08-24 21:28:50 +02:00
|
|
|
export interface IAccessRepositoryMock {
|
2023-11-01 04:13:34 +01:00
|
|
|
activity: jest.Mocked<IAccessRepository['activity']>;
|
2023-06-28 15:56:24 +02:00
|
|
|
asset: jest.Mocked<IAccessRepository['asset']>;
|
|
|
|
album: jest.Mocked<IAccessRepository['album']>;
|
2023-10-30 16:48:38 +01:00
|
|
|
authDevice: jest.Mocked<IAccessRepository['authDevice']>;
|
2023-06-28 15:56:24 +02:00
|
|
|
library: jest.Mocked<IAccessRepository['library']>;
|
2023-09-20 13:16:33 +02:00
|
|
|
timeline: jest.Mocked<IAccessRepository['timeline']>;
|
2023-09-18 23:22:44 +02:00
|
|
|
person: jest.Mocked<IAccessRepository['person']>;
|
2023-11-11 22:06:19 +01:00
|
|
|
partner: jest.Mocked<IAccessRepository['partner']>;
|
2023-08-24 21:28:50 +02:00
|
|
|
}
|
2023-06-28 15:56:24 +02:00
|
|
|
|
2023-10-23 14:37:51 +02:00
|
|
|
export const newAccessRepositoryMock = (reset = true): IAccessRepositoryMock => {
|
|
|
|
if (reset) {
|
|
|
|
AccessCore.reset();
|
|
|
|
}
|
|
|
|
|
2023-06-06 22:18:38 +02:00
|
|
|
return {
|
2023-11-01 04:13:34 +01:00
|
|
|
activity: {
|
|
|
|
hasOwnerAccess: jest.fn(),
|
|
|
|
hasAlbumOwnerAccess: jest.fn(),
|
2023-11-07 05:37:21 +01:00
|
|
|
hasCreateAccess: jest.fn(),
|
2023-11-01 04:13:34 +01:00
|
|
|
},
|
2023-06-28 15:56:24 +02:00
|
|
|
asset: {
|
|
|
|
hasOwnerAccess: jest.fn(),
|
|
|
|
hasAlbumAccess: jest.fn(),
|
|
|
|
hasPartnerAccess: jest.fn(),
|
|
|
|
hasSharedLinkAccess: jest.fn(),
|
|
|
|
},
|
2023-06-21 03:08:43 +02:00
|
|
|
|
2023-06-28 15:56:24 +02:00
|
|
|
album: {
|
2023-11-25 23:56:23 +01:00
|
|
|
checkOwnerAccess: jest.fn().mockResolvedValue(new Set()),
|
|
|
|
checkSharedAlbumAccess: jest.fn().mockResolvedValue(new Set()),
|
|
|
|
checkSharedLinkAccess: jest.fn().mockResolvedValue(new Set()),
|
2023-06-28 15:56:24 +02:00
|
|
|
},
|
2023-06-21 03:08:43 +02:00
|
|
|
|
2023-10-30 16:48:38 +01:00
|
|
|
authDevice: {
|
|
|
|
hasOwnerAccess: jest.fn(),
|
|
|
|
},
|
|
|
|
|
2023-06-28 15:56:24 +02:00
|
|
|
library: {
|
2023-09-20 13:16:33 +02:00
|
|
|
hasOwnerAccess: jest.fn(),
|
|
|
|
hasPartnerAccess: jest.fn(),
|
|
|
|
},
|
|
|
|
|
|
|
|
timeline: {
|
2023-06-28 15:56:24 +02:00
|
|
|
hasPartnerAccess: jest.fn(),
|
|
|
|
},
|
2023-09-18 23:22:44 +02:00
|
|
|
|
|
|
|
person: {
|
|
|
|
hasOwnerAccess: jest.fn(),
|
|
|
|
},
|
2023-11-11 22:06:19 +01:00
|
|
|
|
|
|
|
partner: {
|
|
|
|
hasUpdateAccess: jest.fn(),
|
|
|
|
},
|
2023-06-06 22:18:38 +02:00
|
|
|
};
|
|
|
|
};
|