t3-code-android-nightly/.repos/alchemy-effect/examples/railway-website-vocs/test/integ.test.ts
Julius Marminge e3c85ead63
chore(refs): sync Effect and Alchemy references to rc.115 and beta.78 (#12327)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-09-17 23:21:25 -07:00

68 lines
2 KiB
TypeScript

import * as Alchemy from "alchemy";
import * as Railway from "alchemy/Railway";
import * as Test from "alchemy/Test/Bun";
import { expect } from "bun:test";
import * as Console from "effect/Console";
import * as Effect from "effect/Effect";
import Stack from "../alchemy.run.ts";
const { getWhenReady } = Test;
const { test, beforeAll, afterAll, deploy, destroy } = Test.make({
providers: Railway.providers(),
state: Alchemy.localState(),
profile: process.env.ALCHEMY_PROFILE,
});
const stack = beforeAll(deploy(Stack).pipe(Effect.tap(Console.log)), {
timeout: 600_000,
});
afterAll.skipIf(!!process.env.NO_DESTROY)(destroy(Stack));
const base = Effect.map(stack, ({ url }) => {
if (!url) throw new Error("expected the site to expose a url");
return url.replace(/\/+$/, "");
});
test(
"deploys and exposes a url",
Effect.gen(function* () {
const { url } = yield* stack;
expect(url).toBeString();
}),
{ timeout: 180_000 },
);
test(
"serves documentation pages",
Effect.gen(function* () {
const url = yield* base;
const home = yield* getWhenReady(url);
expect(home.status).toBe(200);
expect(yield* home.text).toContain("Alchemy with Vocs");
const guide = yield* getWhenReady(`${url}/guide`);
expect(guide.status).toBe(200);
expect(yield* guide.text).toContain("Deployment guide");
const counter = yield* getWhenReady(`${url}/counter`);
expect(counter.status).toBe(200);
expect(yield* counter.text).toContain("Interactive component");
}),
{ timeout: 180_000 },
);
test(
"serves public and generated assets",
Effect.gen(function* () {
const url = yield* base;
const asset = yield* getWhenReady(`${url}/hello.txt`);
expect(asset.status).toBe(200);
expect(yield* asset.text).toContain("Vocs public directory");
const llms = yield* getWhenReady(`${url}/llms.txt`);
expect(llms.status).toBe(200);
expect(yield* llms.text).toContain("Alchemy with Vocs");
}),
{ timeout: 180_000 },
);