mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
add two more unit tests
This commit is contained in:
parent
8702586e9e
commit
917b738aa8
BIN
test/backend/assets/sidecar/metadata.jpg
Normal file
BIN
test/backend/assets/sidecar/metadata.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.4 KiB |
12
test/backend/assets/sidecar/metadata.jpg.json
Normal file
12
test/backend/assets/sidecar/metadata.jpg.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"size": {
|
||||||
|
"width": 10,
|
||||||
|
"height": 5
|
||||||
|
},
|
||||||
|
"creationDate": 1709057753000,
|
||||||
|
"fileSize": 4489,
|
||||||
|
"keywords": [
|
||||||
|
"floor",
|
||||||
|
"book"
|
||||||
|
]
|
||||||
|
}
|
BIN
test/backend/assets/sidecar/metadata_v2.jpg
Normal file
BIN
test/backend/assets/sidecar/metadata_v2.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.4 KiB |
15
test/backend/assets/sidecar/metadata_v2.jpg.json
Normal file
15
test/backend/assets/sidecar/metadata_v2.jpg.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"size": {
|
||||||
|
"width": 10,
|
||||||
|
"height": 5
|
||||||
|
},
|
||||||
|
"creationDate": 1709057753000,
|
||||||
|
"fileSize": 4489,
|
||||||
|
"keywords": [
|
||||||
|
"floor",
|
||||||
|
"book",
|
||||||
|
"first",
|
||||||
|
"second"
|
||||||
|
],
|
||||||
|
"rating": 0
|
||||||
|
}
|
18
test/backend/assets/sidecar/metadata_v2.xmp
Normal file
18
test/backend/assets/sidecar/metadata_v2.xmp
Normal 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>
|
@ -117,6 +117,17 @@ describe('MetadataLoader', () => {
|
|||||||
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
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', () => {
|
describe('should load jpg with proper height and orientation', () => {
|
||||||
it('jpg 1', async () => {
|
it('jpg 1', async () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user