Skip to content

Commit

Permalink
Fix Windows tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Dec 6, 2024
1 parent 931d436 commit 8cc9e60
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions test/AutoCopyPluginTest.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import test from "ava";
import fs from "node:fs";
import { rimrafSync } from "rimraf";
import { TemplatePath } from "@11ty/eleventy-utils";

import { AutoCopyPlugin } from "../src/Plugins/AutoCopyPlugin.js";
import { TransformPlugin as InputPathToUrlTransformPlugin } from "../src/Plugins/InputPathToUrl.js";
Expand All @@ -18,7 +19,7 @@ test("Basic usage", async (t) => {
eleventyConfig.on("eleventy.passthrough", copyMap => {
t.deepEqual(copyMap, {
map: {
"/test/possum.png": "test/stubs-autocopy/possum.png"
"/test/possum.png": TemplatePath.normalizeOperatingSystemFilePath("test/stubs-autocopy/possum.png")
}
})
});
Expand All @@ -45,7 +46,7 @@ test("Basic usage", async (t) => {
t.deepEqual(copy[0], {
count: 1,
map: {
"test/stubs-autocopy/possum.png": "test/stubs-autocopy/_site-basica/test/possum.png",
"test/stubs-autocopy/possum.png": TemplatePath.normalizeOperatingSystemFilePath("test/stubs-autocopy/_site-basica/test/possum.png"),
}
});

Expand All @@ -68,7 +69,7 @@ test("More complex image path (parent dir)", async (t) => {
eleventyConfig.on("eleventy.passthrough", copyMap => {
t.deepEqual(copyMap, {
map: {
"/stubs-img-transform/possum.png": "test/stubs-img-transform/possum.png"
"/stubs-img-transform/possum.png": TemplatePath.normalizeOperatingSystemFilePath("test/stubs-img-transform/possum.png")
}
})
});
Expand Down Expand Up @@ -96,7 +97,7 @@ test("More complex image path (parent dir)", async (t) => {
count: 1,
map: {
// test/stubs-autocopy/test.njk => "../stubs-img-transform/possum.png"
"test/stubs-img-transform/possum.png": "test/stubs-autocopy/_site-basicb/stubs-img-transform/possum.png",
"test/stubs-img-transform/possum.png": TemplatePath.normalizeOperatingSystemFilePath("test/stubs-autocopy/_site-basicb/stubs-img-transform/possum.png"),
}
});

Expand Down Expand Up @@ -322,7 +323,7 @@ test("Use with HtmlBasePlugin usage", async (t) => {
eleventyConfig.on("eleventy.passthrough", copyMap => {
t.deepEqual(copyMap, {
map: {
"/test/possum.png": "test/stubs-autocopy/possum.png"
"/test/possum.png": TemplatePath.normalizeOperatingSystemFilePath("test/stubs-autocopy/possum.png")
}
})
});
Expand All @@ -349,7 +350,7 @@ test("Use with HtmlBasePlugin usage", async (t) => {
t.deepEqual(copy[0], {
count: 1,
map: {
"test/stubs-autocopy/possum.png": "test/stubs-autocopy/_site8a/test/possum.png",
"test/stubs-autocopy/possum.png": TemplatePath.normalizeOperatingSystemFilePath("test/stubs-autocopy/_site8a/test/possum.png"),
}
});

Expand Down Expand Up @@ -414,8 +415,8 @@ test("Multiple addPlugin calls (use both globs)", async (t) => {
eleventyConfig.on("eleventy.passthrough", copyMap => {
t.deepEqual(copyMap, {
map: {
"/test/possum.jpg": "test/stubs-autocopy/possum.jpg",
"/test/possum.png": "test/stubs-autocopy/possum.png",
"/test/possum.jpg": TemplatePath.normalizeOperatingSystemFilePath("test/stubs-autocopy/possum.jpg"),
"/test/possum.png": TemplatePath.normalizeOperatingSystemFilePath("test/stubs-autocopy/possum.png"),
}
})
});
Expand All @@ -442,13 +443,13 @@ test("Multiple addPlugin calls (use both globs)", async (t) => {
t.deepEqual(copy[0], {
count: 1,
map: {
"test/stubs-autocopy/possum.png": "test/stubs-autocopy/_site9/test/possum.png",
"test/stubs-autocopy/possum.png": TemplatePath.normalizeOperatingSystemFilePath("test/stubs-autocopy/_site9/test/possum.png"),
}
});
t.deepEqual(copy[1], {
count: 1,
map: {
"test/stubs-autocopy/possum.jpg": "test/stubs-autocopy/_site9/test/possum.jpg",
"test/stubs-autocopy/possum.jpg": TemplatePath.normalizeOperatingSystemFilePath("test/stubs-autocopy/_site9/test/possum.jpg"),
}
});

Expand All @@ -472,8 +473,8 @@ test("Array of globs", async (t) => {
eleventyConfig.on("eleventy.passthrough", copyMap => {
t.deepEqual(copyMap, {
map: {
"/test/possum.jpg": "test/stubs-autocopy/possum.jpg",
"/test/possum.png": "test/stubs-autocopy/possum.png",
"/test/possum.jpg": TemplatePath.normalizeOperatingSystemFilePath("test/stubs-autocopy/possum.jpg"),
"/test/possum.png": TemplatePath.normalizeOperatingSystemFilePath("test/stubs-autocopy/possum.png"),
}
})
});
Expand All @@ -500,13 +501,13 @@ test("Array of globs", async (t) => {
t.deepEqual(copy[0], {
count: 1,
map: {
"test/stubs-autocopy/possum.png": "test/stubs-autocopy/_site10/test/possum.png",
"test/stubs-autocopy/possum.png": TemplatePath.normalizeOperatingSystemFilePath("test/stubs-autocopy/_site10/test/possum.png"),
}
});
t.deepEqual(copy[1], {
count: 1,
map: {
"test/stubs-autocopy/possum.jpg": "test/stubs-autocopy/_site10/test/possum.jpg",
"test/stubs-autocopy/possum.jpg": TemplatePath.normalizeOperatingSystemFilePath("test/stubs-autocopy/_site10/test/possum.jpg"),
}
});

Expand Down

0 comments on commit 8cc9e60

Please sign in to comment.