| 1 | import assert from "node:assert/strict"; |
| 2 | import { test } from "node:test"; |
| 3 | |
| 4 | import { detectedLabel, sizeLabel } from "./deploy-kind.ts"; |
| 5 | |
| 6 | const NAMES = { astro: "Astro", dockerfile: "Dockerfile", flask: "Flask", nextjs: "Next.js" }; |
| 7 | |
| 8 | test("what a build found is said with what it was built with", () => { |
| 9 | assert.equal(detectedLabel("static", "astro", NAMES), "Static site · Astro"); |
| 10 | assert.equal(detectedLabel("container", "dockerfile", NAMES), "Container · Dockerfile"); |
| 11 | assert.equal(detectedLabel("container", "flask", NAMES), "Container · Flask, with a Dockerfile g1t wrote"); |
| 12 | assert.equal(detectedLabel("workers", null, NAMES), "Workers project"); |
| 13 | assert.equal(detectedLabel("html", "unknown", NAMES), "Plain HTML"); |
| 14 | }); |
| 15 | |
| 16 | test("a container size reads plainly", () => { |
| 17 | assert.equal(sizeLabel({ vcpu: 1 / 16, memoryGib: 0.25, diskGb: 2 }), "1/16 vCPU, 256 MiB, 2 GB disk"); |
| 18 | assert.equal(sizeLabel({ vcpu: 2, memoryGib: 8, diskGb: 16 }), "2 vCPU, 8 GiB, 16 GB disk"); |
| 19 | }); |