@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 63 lines 2.31 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 pathe from "pathe";
6 import { cloneFixture } from "../../Cloudflare/Utils/Fixture.ts";
7 import { expectUrlContains } from "../../Cloudflare/Utils/Http.ts";
8
9 const { test } = Test.make({ providers: Fly.providers(), dev: true });
10
11 const fixtureDir = pathe.resolve(import.meta.dirname, "../../AWS/Website/fixtures/waku-app");
12 const tempRoot = pathe.resolve(import.meta.dirname, "../../../.tmp");
13 const fixtureEntries = [".gitignore", "package.json", "tsconfig.json", "src", "public"];
14
15 describe(
16 "Fly.Website.Waku local",
17 { tags: ["provider:fly", "provider:fly:website", "local"] },
18 () => {
19 test.provider(
20 "dev runs the framework server with no cloud resources",
21 (stack) =>
22 Effect.gen(function* () {
23 yield* stack.destroy();
24
25 const rootDir = yield* cloneFixture(fixtureDir, {
26 prefix: "alchemy-waku-fly-local-",
27 tempRoot,
28 entries: fixtureEntries,
29 });
30
31 const deployed = yield* stack.deploy(
32 Effect.gen(function* () {
33 const site = yield* Fly.Website.Waku("Web", { rootDir });
34 return { site };
35 }),
36 );
37
38 const url = deployed.site.url;
39 expect(url).toMatch(/^http:\/\/(localhost|127\.0\.0\.1):\d+\/?$/);
40 expect(deployed.site.service).toBeUndefined();
41 expect(deployed.site.app).toBeUndefined();
42 expect(deployed.site.ip).toBeUndefined();
43
44 // Vite may report `http://host:port/`; joining another `/` would
45 // hit `//`, which waku's router does not match.
46 const origin = String(url).replace(/\/+$/, "");
47 yield* expectUrlContains(`${origin}/`, "WAKU_AWS_PAGE_MARKER", {
48 timeout: "180 seconds",
49 label: "dev home page",
50 });
51 yield* expectUrlContains(`${origin}/echo?echo=roundtrip`, "WAKU_AWS_API_MARKER", {
52 label: "api route (dev)",
53 });
54 yield* expectUrlContains(`${origin}/about`, "WAKU_AWS_STATIC_MARKER", {
55 label: "extra route (dev)",
56 });
57
58 yield* stack.destroy();
59 }),
60 { timeout: 210_000 },
61 );
62 },
63 );