fix: withFilePath select edited or unedited file (#27328)

* fix: withFilePath select edited or unedited file

* chore: test
This commit is contained in:
Brandon Wees 2026-04-01 07:19:38 -05:00 committed by GitHub
parent 4ef777d145
commit c29493e3a0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 43 additions and 19 deletions

View file

@ -115,4 +115,33 @@ describe(AssetJobRepository.name, () => {
);
});
});
describe('getForOcr', () => {
it('should not return the edited preview file', async () => {
const { ctx, sut } = setup();
const { user } = await ctx.newUser();
const { asset } = await ctx.newAsset({ ownerId: user.id });
await ctx.newAssetFile({
assetId: asset.id,
type: AssetFileType.Preview,
path: 'preview_edited.jpg',
isEdited: true,
});
await ctx.newAssetFile({
assetId: asset.id,
type: AssetFileType.Preview,
path: 'preview_unedited.jpg',
isEdited: false,
});
const result = await sut.getForOcr(asset.id);
expect(result).toEqual(
expect.objectContaining({
previewFile: 'preview_unedited.jpg',
}),
);
});
});
});