@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 06:00 UTC

main
ts 74 lines 2.47 KB
Raw
1 import * as Fly from "@alchemy.run/fly";
2 import { describe, expect } from "@alchemy.run/test";
3 import * as Test from "@alchemy.run/test/Alchemy";
4 import * as Effect from "effect/Effect";
5 import * as FileSystem from "effect/FileSystem";
6 import * as Path from "effect/Path";
7 import * as pathe from "pathe";
8 import { cloneFixture } from "../../Cloudflare/Utils/Fixture.ts";
9 import { expectUrlContains } from "../../Cloudflare/Utils/Http.ts";
10
11 const { test } = Test.make({ providers: Fly.providers(), dev: true });
12
13 const fixtureDir = pathe.resolve(import.meta.dirname, "../../AWS/Website/fixtures/octane-app");
14 const tempRoot = pathe.resolve(import.meta.dirname, "../../../.tmp");
15 const fixtureEntries = [
16 ".gitignore",
17 "package.json",
18 "octane.config.ts",
19 "vite.config.ts",
20 "index.html",
21 "src",
22 "public",
23 ];
24
25 describe(
26 "Fly.Website.Octane local",
27 { tags: ["provider:fly", "provider:fly:website", "local"] },
28 () => {
29 test.provider(
30 "dev runs the framework server with no cloud resources",
31 (stack) =>
32 Effect.gen(function* () {
33 yield* stack.destroy();
34
35 const rootDir = yield* cloneFixture(fixtureDir, {
36 prefix: "alchemy-octane-fly-local-",
37 tempRoot,
38 entries: fixtureEntries,
39 });
40
41 const fs = yield* FileSystem.FileSystem;
42 const pathMod = yield* Path.Path;
43 const configPath = pathMod.join(rootDir, "octane.config.ts");
44 const raw = yield* fs.readFileString(configPath);
45 expect(raw).not.toContain("adapter:");
46 expect(raw).not.toContain("@alchemy.run/frontend-frameworks");
47
48 const deployed = yield* stack.deploy(
49 Effect.gen(function* () {
50 const site = yield* Fly.Website.Octane("Web", { rootDir });
51 return { site };
52 }),
53 );
54
55 const url = deployed.site.url;
56 expect(url).toMatch(/^http:\/\/(localhost|127\.0\.0\.1):\d+\/?$/);
57 expect(deployed.site.service).toBeUndefined();
58 expect(deployed.site.app).toBeUndefined();
59 expect(deployed.site.ip).toBeUndefined();
60
61 yield* expectUrlContains(`${url}/`, "OCTANE_AWS_PAGE_MARKER", {
62 timeout: "90 seconds",
63 label: "dev home page",
64 });
65 yield* expectUrlContains(`${url}/api/hello?echo=roundtrip`, "OCTANE_AWS_API_MARKER", {
66 label: "api route (dev)",
67 });
68
69 yield* stack.destroy();
70 }),
71 { timeout: 120_000 },
72 );
73 },
74 );