import assert from "node:assert/strict";
import crypto from "node:crypto";
import fs from "node:fs";
import http from "node:http";
import os from "node:os";
import path from "node:path";
import {
createDeploymentHttpServer,
listenDeploymentHttpServer,
loadDeploymentContract,
} from "./deployment-http-server.mjs";
const contract = loadDeploymentContract();
const root = fs.mkdtempSync(path.join(os.tmpdir(), "blender-deployment-http-"));
function write(relative, bytes) {
const filePath = path.join(root, relative);
fs.mkdirSync(path.dirname(filePath), { recursive: true });
fs.writeFileSync(filePath, bytes);
return Buffer.from(bytes);
}
function sha256(bytes) {
return crypto.createHash("sha256").update(bytes).digest("hex");
}
function deterministicBytes(size, seed) {
const bytes = Buffer.alloc(size);
for (let index = 0; index < bytes.length; index += 1) bytes[index] = (index * 31 + seed) & 0xff;
return bytes;
}
const fixtures = new Map([
["/index.html", write("index.html", "
Web Blender")],
["/favicon.svg", write("favicon.svg", "