Skip to content

Commit

Permalink
test: add test cases from exiftool (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
Friendseeker authored Sep 23, 2024
1 parent dfb0000 commit 7a0da0d
Show file tree
Hide file tree
Showing 24 changed files with 4 additions and 2 deletions.
Binary file modified tests/__snapshots__/index.test.js.snap
Binary file not shown.
Binary file added tests/images/AFCP.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/images/Apple.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/images/Canon.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/images/Canon1DmkIII.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/images/Casio.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/images/Casio2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/images/CasioQVCI.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/images/ExifTool.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/images/ExtendedXMP.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/images/FLIR.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/images/FotoStation.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/images/FujiFilm.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/images/GE.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/images/GPS.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/images/GoPro.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/images/IPTC.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/images/InfiRay.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/images/JVC.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/images/JVC2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/images/Kodak.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/images/MWG.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/images/Minolta.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ import JPEG from "../src";

const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
const images = fs.readdirSync(`${__dirname}/images`);
const nonPassingImages = ["AFCP.jpg", "ExifTool.jpg", "FotoStation.jpg"];
const passingImages = images.filter(image => !nonPassingImages.includes(image));

expect.addSnapshotSerializer({
serialize: (val) => Buffer.from(val).toString("hex"),
test: (val) => Buffer.isBuffer(val) || val?.constructor.name === "Uint8Array",
});

describe("decode w/buffers", () => {
it.each(images)("%s", (image) => {
it.each(passingImages)("%s", (image) => {
const buffer = fs.readFileSync(`${__dirname}/images/${image}`);
const markers = JPEG.decode(buffer);

Expand All @@ -23,7 +25,7 @@ describe("decode w/buffers", () => {
});

describe("decode w/int arrays", () => {
it.each(images)("%s", (image) => {
it.each(passingImages)("%s", (image) => {
const buffer = fs.readFileSync(`${__dirname}/images/${image}`);
const markers = JPEG.decode(new Uint8Array(buffer));

Expand Down

0 comments on commit 7a0da0d

Please sign in to comment.