28 lines
718 B
TypeScript
28 lines
718 B
TypeScript
import { access, readFile } from "node:fs/promises";
|
|
import path from "node:path";
|
|
|
|
import { readContentCache } from "../src/lib/content/cache";
|
|
|
|
async function main() {
|
|
const distPath = path.join(process.cwd(), "dist", "blog", "index.html");
|
|
await access(distPath);
|
|
|
|
const html = await readFile(distPath, "utf8");
|
|
|
|
const cache = await readContentCache();
|
|
const posts = cache.wordpress?.posts || [];
|
|
|
|
if (posts.length === 0) {
|
|
if (!html.includes("No blog posts yet.")) {
|
|
throw new Error("Expected /blog empty state to be present when no WordPress posts exist.");
|
|
}
|
|
}
|
|
}
|
|
|
|
main().catch((e) => {
|
|
// eslint-disable-next-line no-console
|
|
console.error(String(e));
|
|
process.exitCode = 1;
|
|
});
|
|
|