import test from "node:test"; import assert from "node:assert/strict"; import { handler } from "../netlify/functions/logo.js"; import { drippedPals } from "../backend/pals-gallery.mjs"; import { logoUrl, turnaroundUrl } from "../backend/logo.mjs"; const request = (path, query = {}) => handler({ httpMethod: "GET", path: `/api/logo/${path}`, queryStringParameters: query, headers: { accept: "text/html" } }); test("the collection exposes both stills and every published motion format", async () => { const catalogue = JSON.parse((await request("pals.json")).body); assert.equal(catalogue.collections[0].url, "https://pals.aesthetic.computer/dripped"); for (const { slug } of drippedPals) { assert.ok(catalogue.stills.find((item) => item.slug === slug)); assert.ok(catalogue.turnarounds.find((item) => item.slug === slug)); for (const format of ["png", "mp4", "webp", "apng"]) { const response = await request(`pals-${slug}.${format}`); assert.equal(response.statusCode, 302); assert.equal(response.headers.Location, format === "png" ? logoUrl(slug) : turnaroundUrl(slug, format)); } } }); test("the gallery offers downloads and explicit motion controls", async () => { const response = await request("dripped"); assert.equal(response.statusCode, 200); assert.match(response.headers["Content-Type"], /text\/html/); assert.equal((response.body.match(/