t3-code-android-nightly/.repos/alchemy-effect/packages/alchemy/test/GCP/Website/SvelteKit.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

67 lines
1.9 KiB
TypeScript

import * as GCP from "@/GCP";
import * as Test from "@/Test/Alchemy";
import { expect } from "alchemy-test";
import * as Effect from "effect/Effect";
import { cloneFixture } from "../../Cloudflare/Utils/Fixture.ts";
import { expectUrlContains } from "../../Cloudflare/Utils/Http.ts";
import { dockerAvailable } from "../bindingHost.ts";
import {
assertSiteGone,
awsFixture,
cloudRunUrl,
liveOptions,
logLevel,
serviceIdentity,
tempRoot,
} from "./site.ts";
const { test } = Test.make({ providers: GCP.providers() });
const fixtureDir = awsFixture("sveltekit-app");
const fixtureEntries = [".gitignore", "package.json", "src", "static"];
test.provider.skipIf(!dockerAvailable)(
"SvelteKit: deploy, GET page and API route, destroy, gone",
(stack) =>
Effect.gen(function* () {
yield* stack.destroy();
const rootDir = yield* cloneFixture(fixtureDir, {
prefix: "alchemy-sveltekit-gcp-",
tempRoot,
entries: fixtureEntries,
});
const deployed = yield* stack.deploy(
Effect.gen(function* () {
const site = yield* GCP.Website.SvelteKit("Web", {
rootDir,
memo: { include: ["src/**", "static/**", "package.json"] },
});
return { site };
}),
);
const url = deployed.site.url as string;
expect(url).toMatch(cloudRunUrl);
expect(deployed.site.service).toBeDefined();
const service = serviceIdentity(deployed.site.service!);
yield* expectUrlContains(`${url}/`, "SVELTEKIT_AWS_PAGE_MARKER", {
timeout: "180 seconds",
label: "SvelteKit /",
});
yield* expectUrlContains(
`${url}/api/hello?echo=roundtrip`,
"SVELTEKIT_AWS_API_MARKER",
{
timeout: "30 seconds",
label: "SvelteKit /api/hello?echo=roundtrip",
},
);
yield* stack.destroy();
yield* assertSiteGone(service);
}).pipe(logLevel),
liveOptions(900_000),
);