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

80 lines
2.5 KiB
TypeScript

import * as Railway from "@/Railway";
import * as Test from "@/Test/Alchemy";
import { describe, expect } from "alchemy-test";
import * as Effect from "effect/Effect";
import * as FileSystem from "effect/FileSystem";
import * as Path from "effect/Path";
import * as pathe from "pathe";
import { cloneFixture } from "../../Cloudflare/Utils/Fixture.ts";
import { expectUrlContains } from "../../Cloudflare/Utils/Http.ts";
const { test } = Test.make({ providers: Railway.providers(), dev: true });
const fixtureDir = pathe.resolve(
import.meta.dirname,
"../../AWS/Website/fixtures/octane-app",
);
const tempRoot = pathe.resolve(import.meta.dirname, "../../../.tmp");
const fixtureEntries = [
".gitignore",
"package.json",
"octane.config.ts",
"vite.config.ts",
"index.html",
"src",
"public",
];
describe(
"Railway.Website.Octane local",
{ tags: ["provider:railway", "provider:railway:website", "local"] },
() => {
test.provider(
"dev runs the framework server with no cloud resources",
(stack) =>
Effect.gen(function* () {
yield* stack.destroy();
const rootDir = yield* cloneFixture(fixtureDir, {
prefix: "alchemy-octane-railway-local-",
tempRoot,
entries: fixtureEntries,
});
const fs = yield* FileSystem.FileSystem;
const pathMod = yield* Path.Path;
const configPath = pathMod.join(rootDir, "octane.config.ts");
const raw = yield* fs.readFileString(configPath);
expect(raw).not.toContain("adapter:");
expect(raw).not.toContain("@alchemy.run/frontend-frameworks");
const deployed = yield* stack.deploy(
Effect.gen(function* () {
const site = yield* Railway.Website.Octane("Web", {
rootDir,
});
return { site };
}),
);
const url = deployed.site.url;
expect(url).toMatch(/^http:\/\/(localhost|127\.0\.0\.1):\d+\/?$/);
expect(deployed.site.service).toBeUndefined();
expect(deployed.site.project).toBeUndefined();
yield* expectUrlContains(`${url}/`, "OCTANE_AWS_PAGE_MARKER", {
timeout: "90 seconds",
label: "dev home page",
});
yield* expectUrlContains(
`${url}/api/hello?echo=roundtrip`,
"OCTANE_AWS_API_MARKER",
{ label: "api route (dev)" },
);
yield* stack.destroy();
}),
{ timeout: 120_000 },
);
},
);