From 917b738aa8a1a236e92555a169bd0d34e6548300 Mon Sep 17 00:00:00 2001 From: kagahd Date: Wed, 28 Feb 2024 18:50:19 +0100 Subject: [PATCH] add two more unit tests --- test/backend/assets/sidecar/metadata.jpg | Bin 0 -> 4489 bytes test/backend/assets/sidecar/metadata.jpg.json | 12 ++++++++++++ test/backend/assets/sidecar/metadata_v2.jpg | Bin 0 -> 4489 bytes .../assets/sidecar/metadata_v2.jpg.json | 15 +++++++++++++++ test/backend/assets/sidecar/metadata_v2.xmp | 18 ++++++++++++++++++ .../model/threading/MetaDataLoader.spec.ts | 11 +++++++++++ 6 files changed, 56 insertions(+) create mode 100644 test/backend/assets/sidecar/metadata.jpg create mode 100644 test/backend/assets/sidecar/metadata.jpg.json create mode 100644 test/backend/assets/sidecar/metadata_v2.jpg create mode 100644 test/backend/assets/sidecar/metadata_v2.jpg.json create mode 100644 test/backend/assets/sidecar/metadata_v2.xmp diff --git a/test/backend/assets/sidecar/metadata.jpg b/test/backend/assets/sidecar/metadata.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c3d685e8df29ddfb9a23c6594e593a328e74acc1 GIT binary patch literal 4489 zcmeHKS!^3c7@j?RZ7YZy*GUa1+jWyV5%#V(Nn5XMhbE~TR|?8eXn?2ndTnoFd)@U0 zyOt12ISRama=(Rg_N|n1K0u+IZ!K4k7s64Fhtfd9Q4nU~EPf7}c7(zqfFKAMf$0|fqa zu-^bX%dkBh!*c9q(z}K8_Hw=5a8_#=z>qT52uBE7wkM&DR_s|+!@)hP^MFuogW?%5 z0F1c7Xuyp|gVAI%nu#WYuviG&RadWWYO%Gpw%F`;$93&(j%%FP+U?}^q_bmVXIJOC zHaFvTG3~BSmlgyunM{P4XeNkem&5LG{o_`A6Iji_00<1B0BS`rD^ffL+F+grsG25R zr6DK=^EH_*#3~3l(gaWh!%!SE7;qe-?||z7w;I;0_ii;dkMbsJw~d{doijW84;@`Q zcKrN??ufG2LfBhc*E!ldHo7{ydU`i)-s0m12DgQ_4~2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QhbKPz_>)gRJ9+B#{1;z-_4V0rzWwg|g&%*qu=w*Yzy5YnZZT6*sK+8rN(cHSxQfDR#ze>z|!FbkySP9y`A_q8ume8+zv3 z7c^=mX7v%<`>&Yk#FlxT2CFdy77w$6J}|R*+Xdz9xsW(=F#P+06NiIm`uYY^ z>u*q`6b(?jdWV_e%z&7Xh6;)}Ubu0mP?!>YQK~OU`14#ol}U*zPv%p}be78ps8Vna z+S)WtktK*a6`&@DN5}zL5y?#+#=}rSf+R`55{+?VgQ1E$90jOKp1EAklk4`#N}Trk zd_J0CX_j?Eggd(@t@3$yI_oS4S&B0#W(7scsFIu}wYYplo>l`CrER3QN}j2VzEMp< zYB>!{f+A<-m^zY>Rk_+fwX{+aHKQ$;WUUn?D(Ie>X(d@A7!_zSDW=41FXOGqo-`|whYjGuwOAB=+W9zXRo9I&1V>INd zMwJu2y#hFrQ7^%xDg>QPC@Tuv@x`T8!V;hjAPFXxT-X5+nC_^;lZ Fe*t + + + 0 + 0 + + + first + second + + + + + diff --git a/test/backend/unit/model/threading/MetaDataLoader.spec.ts b/test/backend/unit/model/threading/MetaDataLoader.spec.ts index 8865a67c..e3465079 100644 --- a/test/backend/unit/model/threading/MetaDataLoader.spec.ts +++ b/test/backend/unit/model/threading/MetaDataLoader.spec.ts @@ -117,6 +117,17 @@ describe('MetadataLoader', () => { expect(Utils.clone(data)).to.be.deep.equal(expected); }); + it('should read keywords from photo without sidecar file', async () => { + const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/sidecar/metadata.jpg')); + const expected = require(path.join(__dirname, '/../../../assets/sidecar/metadata.jpg.json')); + expect(Utils.clone(data)).to.be.deep.equal(expected); + }); + + it('should merge keywords from photo with keywords from sidecar', async () => { + const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/sidecar/metadata_v2.jpg')); + const expected = require(path.join(__dirname, '/../../../assets/sidecar/metadata_v2.jpg.json')); //"metadata_v2.jpg" is identical to "metadata.jpg" and "metadata_v2.xmp" contains 2 different keywords expect(Utils.clone(data)).to.be.deep.equal(expected); + }); + describe('should load jpg with proper height and orientation', () => { it('jpg 1', async () => {