fix: unsafe cast (#17590)
This commit is contained in:
@@ -663,7 +663,7 @@ describe(AssetMediaService.name, () => {
|
||||
});
|
||||
|
||||
describe('replaceAsset', () => {
|
||||
it('should error when update photo does not exist', async () => {
|
||||
it('should fail the auth check when update photo does not exist', async () => {
|
||||
await expect(sut.replaceAsset(authStub.user1, 'id', replaceDto, fileStub.photo)).rejects.toThrow(
|
||||
'Not found or no asset.update access',
|
||||
);
|
||||
@@ -671,6 +671,15 @@ describe(AssetMediaService.name, () => {
|
||||
expect(mocks.asset.create).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should fail if asset cannot be fetched', async () => {
|
||||
mocks.access.asset.checkOwnerAccess.mockResolvedValue(new Set([existingAsset.id]));
|
||||
await expect(sut.replaceAsset(authStub.user1, existingAsset.id, replaceDto, fileStub.photo)).rejects.toThrow(
|
||||
'Asset not found',
|
||||
);
|
||||
|
||||
expect(mocks.asset.create).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should update a photo with no sidecar to photo with no sidecar', async () => {
|
||||
const updatedFile = fileStub.photo;
|
||||
const updatedAsset = { ...existingAsset, ...updatedFile };
|
||||
|
||||
Reference in New Issue
Block a user