-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
55 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
const test = require("ava"); | ||
const exifr = require("exifr"); | ||
|
||
const eleventyImage = require("../img.js"); | ||
|
||
test("Transforms Empty", async t => { | ||
let stats = await eleventyImage("./test/exif-sample-large.jpg", { | ||
formats: ["auto"], | ||
// transform: undefined, | ||
dryRun: true, | ||
}); | ||
|
||
let exif = await exifr.parse(stats.jpeg[0].buffer); | ||
t.deepEqual(exif, undefined); | ||
}); | ||
|
||
test("Transforms keep exif", async t => { | ||
let stats = await eleventyImage("./test/exif-sample-large.jpg", { | ||
formats: ["auto"], | ||
// Keep exif metadata | ||
transform: (sharp) => { | ||
sharp.keepExif(); | ||
}, | ||
dryRun: true, | ||
}); | ||
|
||
let exif = await exifr.parse(stats.jpeg[0].buffer); | ||
|
||
t.is(Math.round(exif.latitude), 50); | ||
t.is(Math.round(exif.longitude), 15); | ||
t.is(exif.ApertureValue, 2); | ||
t.is(exif.BrightnessValue, 9.38); | ||
}); |