Skip to content

Commit a65005b

Browse files
committed
Test for #3697
1 parent 8cca7af commit a65005b

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

test/_issues/3697/3697-test.js

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// import path from "node:path";
2+
// import { fileURLToPath } from "node:url";
3+
import test from "ava";
4+
import Eleventy from "../../../src/Eleventy.js";
5+
6+
test("Number file names on global data files", async t => {
7+
// TODO fix absolute paths here
8+
// let dir = path.parse(fileURLToPath(import.meta.url)).dir;
9+
let dir = "./test/_issues/3697/";
10+
let elev = new Eleventy(dir, undefined, {
11+
config: function (eleventyConfig) {
12+
eleventyConfig.addTemplate("index.11ty.js", function(data) {
13+
return '' + JSON.stringify(data.folder);
14+
})
15+
},
16+
});
17+
18+
let results = await elev.toJSON();
19+
t.is(results.length, 1);
20+
t.is(results[0].content, `[{"key":"value"},null,null,{}]`);
21+
});

test/_issues/3697/_data/folder/0.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"key": "value"
3+
}

test/_issues/3697/_data/folder/3.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

0 commit comments

Comments
 (0)