Skip to content

Commit

Permalink
fix hashes in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroby0 committed Aug 6, 2021
1 parent 27a1a2b commit 9d13b54
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 34 deletions.
26 changes: 13 additions & 13 deletions test/test-markup.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ test("Image markup (defaults)", async t => {

t.is(generateHTML(results, {
alt: ""
}), `<picture><source type="image/webp" srcset="/img/e1d4b79f-1280.webp 1280w"><img alt="" src="/img/e1d4b79f-1280.jpeg" width="1280" height="853"></picture>`);
}), `<picture><source type="image/webp" srcset="/img/70DaY9n7K_-1280.webp 1280w"><img alt="" src="/img/70DaY9n7K_-1280.jpeg" width="1280" height="853"></picture>`);
});

test("Image service", async t => {
Expand Down Expand Up @@ -45,13 +45,13 @@ test("Image object (defaults)", async t => {
{
"source": {
type: "image/webp",
srcset: "/img/e1d4b79f-1280.webp 1280w",
srcset: "/img/70DaY9n7K_-1280.webp 1280w",
}
},
{
"img": {
alt: "",
src: "/img/e1d4b79f-1280.jpeg",
src: "/img/70DaY9n7K_-1280.jpeg",
width: 1280,
height: 853,
}
Expand All @@ -70,9 +70,9 @@ test("Image markup (two widths)", async t => {
alt: "",
sizes: "100vw",
}), [`<picture>`,
`<source type="image/webp" srcset="/img/e1d4b79f-200.webp 200w, /img/e1d4b79f-400.webp 400w" sizes="100vw">`,
`<source type="image/jpeg" srcset="/img/e1d4b79f-200.jpeg 200w, /img/e1d4b79f-400.jpeg 400w" sizes="100vw">`,
`<img alt="" src="/img/e1d4b79f-200.jpeg" width="400" height="266">`,
`<source type="image/webp" srcset="/img/70DaY9n7K_-200.webp 200w, /img/70DaY9n7K_-400.webp 400w" sizes="100vw">`,
`<source type="image/jpeg" srcset="/img/70DaY9n7K_-200.jpeg 200w, /img/70DaY9n7K_-400.jpeg 400w" sizes="100vw">`,
`<img alt="" src="/img/70DaY9n7K_-200.jpeg" width="400" height="266">`,
`</picture>`].join(""));
});

Expand All @@ -95,7 +95,7 @@ test("Image markup (two formats)", async t => {

t.is(generateHTML(results, {
alt: ""
}), `<picture><source type="image/avif" srcset="/img/e1d4b79f-1280.avif 1280w"><img alt="" src="/img/e1d4b79f-1280.webp" width="1280" height="853"></picture>`);
}), `<picture><source type="image/avif" srcset="/img/70DaY9n7K_-1280.avif 1280w"><img alt="" src="/img/70DaY9n7K_-1280.webp" width="1280" height="853"></picture>`);
});

test("Image markup (one format)", async t => {
Expand All @@ -107,7 +107,7 @@ test("Image markup (one format)", async t => {
t.is(generateHTML(results, {
alt: "",
sizes: "100vw"
}), `<img alt="" src="/img/e1d4b79f-1280.jpeg" width="1280" height="853">`);
}), `<img alt="" src="/img/70DaY9n7K_-1280.jpeg" width="1280" height="853">`);
});

test("Image markup (auto format)", async t => {
Expand All @@ -119,7 +119,7 @@ test("Image markup (auto format)", async t => {
t.is(generateHTML(results, {
alt: "",
sizes: "100vw"
}), `<img alt="" src="/img/e1d4b79f-1280.jpeg" width="1280" height="853">`);
}), `<img alt="" src="/img/70DaY9n7K_-1280.jpeg" width="1280" height="853">`);
});

test("Image markup (one format, two widths)", async t => {
Expand All @@ -132,7 +132,7 @@ test("Image markup (one format, two widths)", async t => {
t.is(generateHTML(results, {
alt: "",
sizes: "100vw"
}), `<img alt="" src="/img/e1d4b79f-100.jpeg" width="200" height="133" srcset="/img/e1d4b79f-100.jpeg 100w, /img/e1d4b79f-200.jpeg 200w" sizes="100vw">`);
}), `<img alt="" src="/img/70DaY9n7K_-100.jpeg" width="200" height="133" srcset="/img/70DaY9n7K_-100.jpeg 100w, /img/70DaY9n7K_-200.jpeg 200w" sizes="100vw">`);
});

test("Image markup (throws on invalid object)", async t => {
Expand Down Expand Up @@ -160,8 +160,8 @@ test("Image markup (defaults, inlined)", async t => {
}, {
whitespaceMode: "block"
}), `<picture>
<source type="image/webp" srcset="/img/e1d4b79f-1280.webp 1280w">
<img alt="" src="/img/e1d4b79f-1280.jpeg" width="1280" height="853">
<source type="image/webp" srcset="/img/70DaY9n7K_-1280.webp 1280w">
<img alt="" src="/img/70DaY9n7K_-1280.jpeg" width="1280" height="853">
</picture>`);
});

Expand All @@ -175,7 +175,7 @@ test("svgShortCircuit and generateHTML: Issue #48", async t => {
let html = eleventyImage.generateHTML(stats, {
alt: "Tiger",
});
t.is(html, `<img alt="Tiger" src="/img/fc94394f-900.svg" width="900" height="900">`);
t.is(html, `<img alt="Tiger" src="/img/UqY06ReSxc-900.svg" width="900" height="900">`);
});

test("Filter out empty format arrays", async t => {
Expand Down
42 changes: 21 additions & 21 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ test("Use 'auto' format as original", async t => {

t.is(stats.auto, undefined);
t.is(stats.jpeg.length, 1);
t.is(stats.jpeg[0].outputPath, path.join("test/img/e1d4b79f-1280.jpeg"));
t.is(stats.jpeg[0].outputPath, path.join("test/img/70DaY9n7K_-1280.jpeg"));
t.is(stats.jpeg[0].width, 1280);
});

Expand All @@ -181,7 +181,7 @@ test("Try to use a width larger than original", async t => {
outputDir: "./test/img/"
});
t.is(stats.jpeg.length, 1);
t.is(stats.jpeg[0].outputPath, path.join("test/img/e1d4b79f-1280.jpeg"));
t.is(stats.jpeg[0].outputPath, path.join("test/img/70DaY9n7K_-1280.jpeg"));
t.is(stats.jpeg[0].width, 1280);
});

Expand All @@ -192,7 +192,7 @@ test("Try to use a width larger than original (two sizes)", async t => {
outputDir: "./test/img/"
});
t.is(stats.jpeg.length, 1);
t.is(stats.jpeg[0].outputPath, path.join("test/img/e1d4b79f-1280.jpeg"));
t.is(stats.jpeg[0].outputPath, path.join("test/img/70DaY9n7K_-1280.jpeg"));
t.is(stats.jpeg[0].width, 1280);
});

Expand All @@ -203,7 +203,7 @@ test("Try to use a width larger than original (with a null in there)", async t =
outputDir: "./test/img/"
});
t.is(stats.jpeg.length, 1);
t.is(stats.jpeg[0].outputPath, path.join("test/img/e1d4b79f-1280.jpeg"));
t.is(stats.jpeg[0].outputPath, path.join("test/img/70DaY9n7K_-1280.jpeg"));
t.is(stats.jpeg[0].width, 1280);
});

Expand All @@ -214,7 +214,7 @@ test("Just falsy width", async t => {
outputDir: "./test/img/"
});
t.is(stats.jpeg.length, 1);
t.is(stats.jpeg[0].outputPath, path.join("test/img/e1d4b79f-1280.jpeg"));
t.is(stats.jpeg[0].outputPath, path.join("test/img/70DaY9n7K_-1280.jpeg"));
t.is(stats.jpeg[0].width, 1280);
});

Expand All @@ -226,7 +226,7 @@ test("Use exact same width as original", async t => {
});
t.is(stats.jpeg.length, 1);
// breaking change in 0.5: always use width in filename
t.is(stats.jpeg[0].outputPath, path.join("test/img/e1d4b79f-1280.jpeg"));
t.is(stats.jpeg[0].outputPath, path.join("test/img/70DaY9n7K_-1280.jpeg"));
t.is(stats.jpeg[0].width, 1280);
});

Expand All @@ -237,7 +237,7 @@ test("Try to use a width larger than original (statsSync)", t => {
});

t.is(stats.jpeg.length, 1);
t.is(stats.jpeg[0].url, "/img/e1d4b79f-1280.jpeg");
t.is(stats.jpeg[0].url, "/img/70DaY9n7K_-1280.jpeg");
t.is(stats.jpeg[0].width, 1280);
});

Expand All @@ -248,7 +248,7 @@ test("Use exact same width as original (statsSync)", t => {
});

t.is(stats.jpeg.length, 1);
t.is(stats.jpeg[0].url, "/img/e1d4b79f-1280.jpeg"); // no width in filename
t.is(stats.jpeg[0].url, "/img/70DaY9n7K_-1280.jpeg"); // no width in filename
t.is(stats.jpeg[0].width, 1280);
});

Expand All @@ -270,13 +270,13 @@ test("Use custom function to define file names", async (t) => {
});

t.is(stats.jpeg.length, 2);
t.is(stats.jpeg[0].outputPath, path.join("test/img/bio-2017-e1d4b79f-600.jpeg"));
t.is(stats.jpeg[0].url, "/img/bio-2017-e1d4b79f-600.jpeg");
t.is(stats.jpeg[0].srcset, "/img/bio-2017-e1d4b79f-600.jpeg 600w");
t.is(stats.jpeg[0].outputPath, path.join("test/img/bio-2017-70DaY9n7K_-600.jpeg"));
t.is(stats.jpeg[0].url, "/img/bio-2017-70DaY9n7K_-600.jpeg");
t.is(stats.jpeg[0].srcset, "/img/bio-2017-70DaY9n7K_-600.jpeg 600w");
t.is(stats.jpeg[0].width, 600);
t.is(stats.jpeg[1].outputPath, path.join("test/img/bio-2017-e1d4b79f-1280.jpeg"));
t.is(stats.jpeg[1].url, "/img/bio-2017-e1d4b79f-1280.jpeg");
t.is(stats.jpeg[1].srcset, "/img/bio-2017-e1d4b79f-1280.jpeg 1280w");
t.is(stats.jpeg[1].outputPath, path.join("test/img/bio-2017-70DaY9n7K_-1280.jpeg"));
t.is(stats.jpeg[1].url, "/img/bio-2017-70DaY9n7K_-1280.jpeg");
t.is(stats.jpeg[1].srcset, "/img/bio-2017-70DaY9n7K_-1280.jpeg 1280w");
t.is(stats.jpeg[1].width, 1280);
});

Expand Down Expand Up @@ -386,7 +386,7 @@ test("Sync by dimension with jpeg input (wrong dimensions, supplied are smaller

// this won’t upscale so it will miss out on higher resolution images but there won’t be any broken image URLs in the output
t.is(stats.jpeg.length, 1);
t.is(stats.jpeg[0].outputPath, path.join("img/e1d4b79f-164.jpeg"));
t.is(stats.jpeg[0].outputPath, path.join("img/70DaY9n7K_-164.jpeg"));
});

test("Sync by dimension with jpeg input (wrong dimensions, supplied are larger than real)", t => {
Expand All @@ -396,8 +396,8 @@ test("Sync by dimension with jpeg input (wrong dimensions, supplied are larger t
});

t.is(stats.jpeg.length, 2);
t.is(stats.jpeg[0].outputPath, path.join("img/e1d4b79f-164.jpeg"));
t.is(stats.jpeg[1].outputPath, path.join("img/e1d4b79f-328.jpeg"));
t.is(stats.jpeg[0].outputPath, path.join("img/70DaY9n7K_-164.jpeg"));
t.is(stats.jpeg[1].outputPath, path.join("img/70DaY9n7K_-328.jpeg"));
});

test("Keep a cache, reuse with same file names and options", async t => {
Expand Down Expand Up @@ -545,14 +545,14 @@ test("Using `jpg` in formats Issue #64", async t => {
t.deepEqual(stats, {
jpeg: [
{
filename: 'e1d4b79f-1280.jpeg',
filename: '70DaY9n7K_-1280.jpeg',
format: 'jpeg',
height: 853,
outputPath: path.join('img/e1d4b79f-1280.jpeg'),
outputPath: path.join('img/70DaY9n7K_-1280.jpeg'),
size: 276231,
sourceType: "image/jpeg",
srcset: '/img/e1d4b79f-1280.jpeg 1280w',
url: '/img/e1d4b79f-1280.jpeg',
srcset: '/img/70DaY9n7K_-1280.jpeg 1280w',
url: '/img/70DaY9n7K_-1280.jpeg',
width: 1280,
},
]
Expand Down

0 comments on commit 9d13b54

Please sign in to comment.