@@ -247,7 +247,7 @@ describe(MetadataService.name, () => {
247
247
it ( 'should handle an asset that could not be found' , async ( ) => {
248
248
await expect ( sut . handleMetadataExtraction ( { id : assetStub . image . id } ) ) . resolves . toBe ( JobStatus . FAILED ) ;
249
249
250
- expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . image . id ] ) ;
250
+ expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . image . id ] , { faces : { person : false } } ) ;
251
251
expect ( assetMock . upsertExif ) . not . toHaveBeenCalled ( ) ;
252
252
expect ( assetMock . update ) . not . toHaveBeenCalled ( ) ;
253
253
} ) ;
@@ -265,7 +265,7 @@ describe(MetadataService.name, () => {
265
265
} ) ;
266
266
267
267
await sut . handleMetadataExtraction ( { id : assetStub . image . id } ) ;
268
- expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . sidecar . id ] ) ;
268
+ expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . sidecar . id ] , { faces : { person : false } } ) ;
269
269
expect ( assetMock . upsertExif ) . toHaveBeenCalledWith ( expect . objectContaining ( { dateTimeOriginal : sidecarDate } ) ) ;
270
270
expect ( assetMock . update ) . toHaveBeenCalledWith ( {
271
271
id : assetStub . image . id ,
@@ -280,7 +280,7 @@ describe(MetadataService.name, () => {
280
280
metadataMock . readTags . mockResolvedValue ( { ISO : [ 160 ] } ) ;
281
281
282
282
await sut . handleMetadataExtraction ( { id : assetStub . image . id } ) ;
283
- expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . image . id ] ) ;
283
+ expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . image . id ] , { faces : { person : false } } ) ;
284
284
expect ( assetMock . upsertExif ) . toHaveBeenCalledWith ( expect . objectContaining ( { iso : 160 } ) ) ;
285
285
expect ( assetMock . update ) . toHaveBeenCalledWith ( {
286
286
id : assetStub . image . id ,
@@ -300,7 +300,7 @@ describe(MetadataService.name, () => {
300
300
} ) ;
301
301
302
302
await sut . handleMetadataExtraction ( { id : assetStub . image . id } ) ;
303
- expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . image . id ] ) ;
303
+ expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . image . id ] , { faces : { person : false } } ) ;
304
304
expect ( assetMock . upsertExif ) . toHaveBeenCalledWith (
305
305
expect . objectContaining ( { city : 'City' , state : 'State' , country : 'Country' } ) ,
306
306
) ;
@@ -320,7 +320,7 @@ describe(MetadataService.name, () => {
320
320
} ) ;
321
321
322
322
await sut . handleMetadataExtraction ( { id : assetStub . image . id } ) ;
323
- expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . image . id ] ) ;
323
+ expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . image . id ] , { faces : { person : false } } ) ;
324
324
expect ( assetMock . upsertExif ) . toHaveBeenCalledWith ( expect . objectContaining ( { latitude : null , longitude : null } ) ) ;
325
325
} ) ;
326
326
@@ -335,7 +335,7 @@ describe(MetadataService.name, () => {
335
335
} ) ;
336
336
337
337
it ( 'should extract hierarchy from TagsList' , async ( ) => {
338
- assetMock . getByIds . mockResolvedValue ( [ assetStub . image ] ) ;
338
+ assetMock . getByIds . mockResolvedValue ( [ assetStub . image ] , { faces : { person : false } } ) ;
339
339
metadataMock . readTags . mockResolvedValue ( { TagsList : [ 'Parent/Child' ] } ) ;
340
340
tagMock . upsertValue . mockResolvedValueOnce ( tagStub . parent ) ;
341
341
tagMock . upsertValue . mockResolvedValueOnce ( tagStub . child ) ;
@@ -482,7 +482,9 @@ describe(MetadataService.name, () => {
482
482
mediaMock . probe . mockResolvedValue ( probeStub . matroskaContainer ) ;
483
483
484
484
await sut . handleMetadataExtraction ( { id : assetStub . livePhotoMotionAsset . id } ) ;
485
- expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . livePhotoMotionAsset . id ] ) ;
485
+ expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . livePhotoMotionAsset . id ] , {
486
+ faces : { person : false } ,
487
+ } ) ;
486
488
expect ( storageMock . createOrOverwriteFile ) . not . toHaveBeenCalled ( ) ;
487
489
expect ( jobMock . queue ) . not . toHaveBeenCalled ( ) ;
488
490
expect ( jobMock . queueAll ) . not . toHaveBeenCalled ( ) ;
@@ -508,7 +510,7 @@ describe(MetadataService.name, () => {
508
510
509
511
await sut . handleMetadataExtraction ( { id : assetStub . video . id } ) ;
510
512
511
- expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . video . id ] ) ;
513
+ expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . video . id ] , { faces : { person : false } } ) ;
512
514
expect ( assetMock . upsertExif ) . toHaveBeenCalledWith (
513
515
expect . objectContaining ( { orientation : Orientation . Rotate270CW . toString ( ) } ) ,
514
516
) ;
@@ -536,7 +538,9 @@ describe(MetadataService.name, () => {
536
538
assetStub . livePhotoWithOriginalFileName . originalPath ,
537
539
'MotionPhotoVideo' ,
538
540
) ;
539
- expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . livePhotoWithOriginalFileName . id ] ) ;
541
+ expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . livePhotoWithOriginalFileName . id ] , {
542
+ faces : { person : false } ,
543
+ } ) ;
540
544
expect ( assetMock . create ) . toHaveBeenCalledWith ( {
541
545
checksum : expect . any ( Buffer ) ,
542
546
deviceAssetId : 'NONE' ,
@@ -579,7 +583,9 @@ describe(MetadataService.name, () => {
579
583
assetStub . livePhotoWithOriginalFileName . originalPath ,
580
584
'EmbeddedVideoFile' ,
581
585
) ;
582
- expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . livePhotoWithOriginalFileName . id ] ) ;
586
+ expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . livePhotoWithOriginalFileName . id ] , {
587
+ faces : { person : false } ,
588
+ } ) ;
583
589
expect ( assetMock . create ) . toHaveBeenCalledWith ( {
584
590
checksum : expect . any ( Buffer ) ,
585
591
deviceAssetId : 'NONE' ,
@@ -619,7 +625,9 @@ describe(MetadataService.name, () => {
619
625
storageMock . readFile . mockResolvedValue ( video ) ;
620
626
621
627
await sut . handleMetadataExtraction ( { id : assetStub . livePhotoWithOriginalFileName . id } ) ;
622
- expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . livePhotoWithOriginalFileName . id ] ) ;
628
+ expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . livePhotoWithOriginalFileName . id ] , {
629
+ faces : { person : false } ,
630
+ } ) ;
623
631
expect ( storageMock . readFile ) . toHaveBeenCalledWith (
624
632
assetStub . livePhotoWithOriginalFileName . originalPath ,
625
633
expect . any ( Object ) ,
@@ -768,7 +776,7 @@ describe(MetadataService.name, () => {
768
776
metadataMock . readTags . mockResolvedValue ( tags ) ;
769
777
770
778
await sut . handleMetadataExtraction ( { id : assetStub . image . id } ) ;
771
- expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . image . id ] ) ;
779
+ expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . image . id ] , { faces : { person : false } } ) ;
772
780
expect ( assetMock . upsertExif ) . toHaveBeenCalledWith ( {
773
781
assetId : assetStub . image . id ,
774
782
bitsPerSample : expect . any ( Number ) ,
@@ -826,7 +834,7 @@ describe(MetadataService.name, () => {
826
834
metadataMock . readTags . mockResolvedValue ( tags ) ;
827
835
828
836
await sut . handleMetadataExtraction ( { id : assetStub . image . id } ) ;
829
- expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . image . id ] ) ;
837
+ expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . image . id ] , { faces : { person : false } } ) ;
830
838
expect ( assetMock . upsertExif ) . toHaveBeenCalledWith (
831
839
expect . objectContaining ( {
832
840
timeZone : 'UTC+0' ,
@@ -846,7 +854,7 @@ describe(MetadataService.name, () => {
846
854
847
855
await sut . handleMetadataExtraction ( { id : assetStub . video . id } ) ;
848
856
849
- expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . video . id ] ) ;
857
+ expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . video . id ] , { faces : { person : false } } ) ;
850
858
expect ( assetMock . upsertExif ) . toHaveBeenCalled ( ) ;
851
859
expect ( assetMock . update ) . toHaveBeenCalledWith (
852
860
expect . objectContaining ( {
@@ -867,7 +875,7 @@ describe(MetadataService.name, () => {
867
875
} ) ;
868
876
await sut . handleMetadataExtraction ( { id : assetStub . image . id } ) ;
869
877
870
- expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . image . id ] ) ;
878
+ expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . image . id ] , { faces : { person : false } } ) ;
871
879
expect ( assetMock . upsertExif ) . toHaveBeenCalled ( ) ;
872
880
expect ( assetMock . update ) . toHaveBeenCalledWith (
873
881
expect . objectContaining ( {
@@ -889,7 +897,7 @@ describe(MetadataService.name, () => {
889
897
890
898
await sut . handleMetadataExtraction ( { id : assetStub . video . id } ) ;
891
899
892
- expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . video . id ] ) ;
900
+ expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . video . id ] , { faces : { person : false } } ) ;
893
901
expect ( assetMock . upsertExif ) . toHaveBeenCalled ( ) ;
894
902
expect ( assetMock . update ) . toHaveBeenCalledWith (
895
903
expect . objectContaining ( {
@@ -911,7 +919,7 @@ describe(MetadataService.name, () => {
911
919
912
920
await sut . handleMetadataExtraction ( { id : assetStub . video . id } ) ;
913
921
914
- expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . video . id ] ) ;
922
+ expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . video . id ] , { faces : { person : false } } ) ;
915
923
expect ( assetMock . upsertExif ) . toHaveBeenCalled ( ) ;
916
924
expect ( assetMock . update ) . toHaveBeenCalledWith (
917
925
expect . objectContaining ( {
@@ -975,11 +983,10 @@ describe(MetadataService.name, () => {
975
983
metadataMock . readTags . mockResolvedValue ( metadataStub . withFaceNoName ) ;
976
984
personMock . getDistinctNames . mockResolvedValue ( [ ] ) ;
977
985
personMock . createAll . mockResolvedValue ( [ ] ) ;
978
- personMock . refreshFaces . mockResolvedValue ( [ ] ) ;
979
986
await sut . handleMetadataExtraction ( { id : assetStub . image . id } ) ;
980
- expect ( personMock . createAll ) . toHaveBeenCalledWith ( [ ] ) ;
981
- expect ( personMock . refreshFaces ) . toHaveBeenCalledWith ( assetStub . primaryImage . id , [ ] , SourceType . EXIF ) ;
982
- expect ( personMock . updateAll ) . toHaveBeenCalledWith ( [ ] ) ;
987
+ expect ( personMock . createAll ) . not . toHaveBeenCalled ( ) ;
988
+ expect ( personMock . refreshFaces ) . not . toHaveBeenCalled ( ) ;
989
+ expect ( personMock . updateAll ) . not . toHaveBeenCalled ( ) ;
983
990
} ) ;
984
991
985
992
it ( 'should skip importing faces with empty name' , async ( ) => {
@@ -988,11 +995,10 @@ describe(MetadataService.name, () => {
988
995
metadataMock . readTags . mockResolvedValue ( metadataStub . withFaceEmptyName ) ;
989
996
personMock . getDistinctNames . mockResolvedValue ( [ ] ) ;
990
997
personMock . createAll . mockResolvedValue ( [ ] ) ;
991
- personMock . refreshFaces . mockResolvedValue ( [ ] ) ;
992
998
await sut . handleMetadataExtraction ( { id : assetStub . image . id } ) ;
993
- expect ( personMock . createAll ) . toHaveBeenCalledWith ( [ ] ) ;
994
- expect ( personMock . refreshFaces ) . toHaveBeenCalledWith ( assetStub . primaryImage . id , [ ] , SourceType . EXIF ) ;
995
- expect ( personMock . updateAll ) . toHaveBeenCalledWith ( [ ] ) ;
999
+ expect ( personMock . createAll ) . not . toHaveBeenCalled ( ) ;
1000
+ expect ( personMock . refreshFaces ) . not . toHaveBeenCalled ( ) ;
1001
+ expect ( personMock . updateAll ) . not . toHaveBeenCalled ( ) ;
996
1002
} ) ;
997
1003
998
1004
it ( 'should apply metadata face tags creating new persons' , async ( ) => {
@@ -1001,14 +1007,12 @@ describe(MetadataService.name, () => {
1001
1007
metadataMock . readTags . mockResolvedValue ( metadataStub . withFace ) ;
1002
1008
personMock . getDistinctNames . mockResolvedValue ( [ ] ) ;
1003
1009
personMock . createAll . mockResolvedValue ( [ personStub . withName . id ] ) ;
1004
- personMock . refreshFaces . mockResolvedValue ( [ 'face-asset-uuid' ] ) ;
1005
1010
personMock . update . mockResolvedValue ( personStub . withName ) ;
1006
1011
await sut . handleMetadataExtraction ( { id : assetStub . primaryImage . id } ) ;
1007
- expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . primaryImage . id ] ) ;
1012
+ expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . primaryImage . id ] , { faces : { person : false } } ) ;
1008
1013
expect ( personMock . getDistinctNames ) . toHaveBeenCalledWith ( assetStub . primaryImage . ownerId , { withHidden : true } ) ;
1009
1014
expect ( personMock . createAll ) . toHaveBeenCalledWith ( [ expect . objectContaining ( { name : personStub . withName . name } ) ] ) ;
1010
1015
expect ( personMock . refreshFaces ) . toHaveBeenCalledWith (
1011
- assetStub . primaryImage . id ,
1012
1016
[
1013
1017
{
1014
1018
id : 'random-uuid' ,
@@ -1023,7 +1027,7 @@ describe(MetadataService.name, () => {
1023
1027
sourceType : SourceType . EXIF ,
1024
1028
} ,
1025
1029
] ,
1026
- SourceType . EXIF ,
1030
+ [ ] ,
1027
1031
) ;
1028
1032
expect ( personMock . updateAll ) . toHaveBeenCalledWith ( [ { id : 'random-uuid' , faceAssetId : 'random-uuid' } ] ) ;
1029
1033
expect ( jobMock . queueAll ) . toHaveBeenCalledWith ( [
@@ -1040,14 +1044,12 @@ describe(MetadataService.name, () => {
1040
1044
metadataMock . readTags . mockResolvedValue ( metadataStub . withFace ) ;
1041
1045
personMock . getDistinctNames . mockResolvedValue ( [ { id : personStub . withName . id , name : personStub . withName . name } ] ) ;
1042
1046
personMock . createAll . mockResolvedValue ( [ ] ) ;
1043
- personMock . refreshFaces . mockResolvedValue ( [ 'face-asset-uuid' ] ) ;
1044
1047
personMock . update . mockResolvedValue ( personStub . withName ) ;
1045
1048
await sut . handleMetadataExtraction ( { id : assetStub . primaryImage . id } ) ;
1046
- expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . primaryImage . id ] ) ;
1049
+ expect ( assetMock . getByIds ) . toHaveBeenCalledWith ( [ assetStub . primaryImage . id ] , { faces : { person : false } } ) ;
1047
1050
expect ( personMock . getDistinctNames ) . toHaveBeenCalledWith ( assetStub . primaryImage . ownerId , { withHidden : true } ) ;
1048
- expect ( personMock . createAll ) . toHaveBeenCalledWith ( [ ] ) ;
1051
+ expect ( personMock . createAll ) . not . toHaveBeenCalled ( ) ;
1049
1052
expect ( personMock . refreshFaces ) . toHaveBeenCalledWith (
1050
- assetStub . primaryImage . id ,
1051
1053
[
1052
1054
{
1053
1055
id : 'random-uuid' ,
@@ -1062,10 +1064,10 @@ describe(MetadataService.name, () => {
1062
1064
sourceType : SourceType . EXIF ,
1063
1065
} ,
1064
1066
] ,
1065
- SourceType . EXIF ,
1067
+ [ ] ,
1066
1068
) ;
1067
- expect ( personMock . updateAll ) . toHaveBeenCalledWith ( [ ] ) ;
1068
- expect ( jobMock . queueAll ) . toHaveBeenCalledWith ( [ ] ) ;
1069
+ expect ( personMock . updateAll ) . not . toHaveBeenCalled ( ) ;
1070
+ expect ( jobMock . queueAll ) . not . toHaveBeenCalledWith ( ) ;
1069
1071
} ) ;
1070
1072
1071
1073
it ( 'should handle invalid modify date' , async ( ) => {
0 commit comments