fix(ingestion): trigger deterministic Eleventy builds on publish and unpublish
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user