fix(ingestion): trigger deterministic Eleventy builds on publish and unpublish

This commit is contained in:
venus
2026-09-14 01:24:07 -05:00
parent 417ec30bfd
commit 22f78da4cb
3 changed files with 65 additions and 17 deletions
+10 -1
View File
@@ -3,7 +3,7 @@ import assert from "node:assert/strict";
import fs from "node:fs";
import path from "node:path";
import http from "node:http";
import { createServer } from "../server.js";
import { createServer, triggerEleventyBuild } from "../server.js";
const TEST_SECRET = "super-secret-test-token";
@@ -274,3 +274,12 @@ test("Ingestion API: adversarial protection against path traversal in slug and D
fs.rmSync(tmpPosts, { recursive: true, force: true });
}
});
test("Ingestion API: triggerEleventyBuild builds site and handles concurrency", async () => {
assert.strictEqual(typeof triggerEleventyBuild, "function");
// Trigger two concurrent calls to assert queuing does not crash or throw
const [b1, b2] = await Promise.all([triggerEleventyBuild(), triggerEleventyBuild()]);
assert.strictEqual(b1, undefined);
assert.strictEqual(b2, undefined);
});