mirror of
https://github.com/immich-app/immich
synced 2026-08-15 13:03:57 +00:00
refactor: asset create event (#28647)
This commit is contained in:
parent
cf991e7b1b
commit
e46f2843f7
5 changed files with 79 additions and 87 deletions
|
|
@ -43,9 +43,11 @@ describe(AssetService.name, () => {
|
|||
ctx.getMock(EventRepository).emit.mockResolvedValue();
|
||||
ctx.getMock(JobRepository).queue.mockResolvedValue();
|
||||
|
||||
const fileSizeInByte = 12_345;
|
||||
|
||||
const { user } = await ctx.newUser();
|
||||
const { asset } = await ctx.newAsset({ ownerId: user.id });
|
||||
await ctx.newExif({ assetId: asset.id, fileSizeInByte: 12_345 });
|
||||
await ctx.newExif({ assetId: asset.id, fileSizeInByte });
|
||||
const auth = factory.auth({ user: { id: user.id } });
|
||||
|
||||
await expect(
|
||||
|
|
@ -56,7 +58,7 @@ describe(AssetService.name, () => {
|
|||
fileCreatedAt: new Date(),
|
||||
assetData: Buffer.from('some data'),
|
||||
},
|
||||
mediumFactory.uploadFile(),
|
||||
mediumFactory.uploadFile({ size: fileSizeInByte }),
|
||||
),
|
||||
).resolves.toEqual({
|
||||
id: expect.any(String),
|
||||
|
|
@ -65,6 +67,7 @@ describe(AssetService.name, () => {
|
|||
|
||||
expect(ctx.getMock(EventRepository).emit).toHaveBeenCalledWith('AssetCreate', {
|
||||
asset: expect.objectContaining({}),
|
||||
file: expect.objectContaining({ size: fileSizeInByte }),
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue