t3-code-android-nightly/.repos/alchemy-effect/packages/alchemy/test/GCP/Website/StaticSite.local.test.ts
Julius Marminge 6f9cea00ae
chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170)
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 13:22:30 -07:00

60 lines
1.9 KiB
TypeScript

import * as GCP from "@/GCP";
import * as Test from "@/Test/Alchemy";
import { describe, expect } from "alchemy-test";
import * as Effect from "effect/Effect";
import * as pathe from "pathe";
import { cloneFixture } from "../../Cloudflare/Utils/Fixture.ts";
import { expectUrlContains } from "../../Cloudflare/Utils/Http.ts";
const { test } = Test.make({ providers: GCP.providers(), dev: true });
const fixtureDir = pathe.resolve(
import.meta.dirname,
"../../Cloudflare/Website/staticsite-fixture",
);
const tempRoot = pathe.resolve(import.meta.dirname, "../../../.tmp");
describe(
"GCP.Website.StaticSite local",
{ tags: ["provider:gcp", "provider:gcp:website", "local"] },
() => {
test.provider(
"dev builds and serves outdir locally with no cloud resources",
(stack) =>
Effect.gen(function* () {
yield* stack.destroy();
const cwd = yield* cloneFixture(fixtureDir, {
prefix: "alchemy-staticsite-gcp-local-",
tempRoot,
entries: ["src", "build.sh"],
});
const deployed = yield* stack.deploy(
Effect.gen(function* () {
const site = yield* GCP.Website.StaticSite("Blog", {
path: cwd,
build: { command: "bash build.sh", output: "dist" },
});
return { site };
}),
);
const url = deployed.site.url;
expect(url).toMatch(/^http:\/\/(localhost|127\.0\.0\.1):\d+\/?$/);
expect(deployed.site.service).toBeUndefined();
yield* expectUrlContains(`${url}/`, "StaticSite fixture v1", {
timeout: "90 seconds",
label: "dev staticsite index",
});
yield* stack.destroy();
}),
{
tags: ["provider:gcp", "provider:gcp:website", "live"],
timeout: 120_000,
},
);
},
);