1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2024-12-23 01:27:14 +02:00

add two more unit tests

This commit is contained in:
kagahd 2024-02-28 18:50:19 +01:00
parent 8702586e9e
commit 917b738aa8
No known key found for this signature in database
GPG Key ID: C7C8777FDE0053DF
6 changed files with 56 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -0,0 +1,12 @@
{
"size": {
"width": 10,
"height": 5
},
"creationDate": 1709057753000,
"fileSize": 4489,
"keywords": [
"floor",
"book"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -0,0 +1,15 @@
{
"size": {
"width": 10,
"height": 5
},
"creationDate": 1709057753000,
"fileSize": 4489,
"keywords": [
"floor",
"book",
"first",
"second"
],
"rating": 0
}

View File

@ -0,0 +1,18 @@
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 6.0.0">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:xmp="http://ns.adobe.com/xap/1.0/"
xmlns:MicrosoftPhoto="http://ns.microsoft.com/photo/1.0/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:lr="http://ns.adobe.com/lightroom/1.0/">
<xmp:Rating>0</xmp:Rating>
<MicrosoftPhoto:Rating>0</MicrosoftPhoto:Rating>
<dc:subject>
<rdf:Bag>
<rdf:li>first</rdf:li>
<rdf:li>second</rdf:li>
</rdf:Bag>
</dc:subject>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>

View File

@ -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 () => {