Cotton code
22 lines · 1.1 KB · TypeScriptRaw
/** * Which commit answers (24 Nov 2026). Since 30 Oct 2026 a busy Durable Object keeps its old code up to 300 s after a * deploy; every object answer names the commit it runs, so the Worker deploy can wait for the owner's to adopt. */import { SELF } from "cloudflare:test";import { describe, expect, it } from "vitest";import { personalObject } from "./personal.ts";describe("the commit an object runs", () => {  it("is named on every answer, a refusal to a stranger too, and by the front Worker's /health", async () => {    await personalObject("object-build");    for (const path of ["/v1/me", "/v1/definitions", "/nothing-here"]) {      const res = await SELF.fetch(`https://example.test/b/object-build${path}`);      await res.arrayBuffer();      // The test Worker is deployed by no one: its build is unnamed (worker-deploy passes BUILD_SHA).      expect(res.headers.get("cotton-object-build"), path).toBe("unnamed");    }    const health = (await (await SELF.fetch("https://example.test/health")).json()) as Record<string, unknown>;    expect(health.build).toBeNull();  });});