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

main
ts 45 lines 1.73 KB
Raw
1 import { describe, expect, it } from "vitest";
2 import { NODE_BUNDLE_CONDITIONS } from "../../core/NodeServe.ts";
3 import { SERVER_ENTRYPOINT, distilledNode, makeNodeTarget, target } from "../node.ts";
4
5 describe("makeNodeTarget", () => {
6 it("declares the node platform, Node bundle conditions, and a finish pass", () => {
7 const node = makeNodeTarget();
8 expect(node.platform).toBe("node");
9 expect(node.bundle?.conditions).toEqual([...NODE_BUNDLE_CONDITIONS]);
10 expect(node.bundle?.external ?? []).not.toContain("cloudflare:");
11 expect(node.bundle?.external ?? []).not.toContain("@aws-sdk/");
12 expect(node.build).toBeTypeOf("function");
13 expect(node.finish).toBeTypeOf("function");
14 expect(node.integration).toBeTypeOf("function");
15 });
16
17 it("pins the node-server entrypoint (not the aws-lambda wrapper)", () => {
18 expect(SERVER_ENTRYPOINT).toBe(
19 "@alchemy.run/frontend-frameworks/astro/entrypoints/node-server",
20 );
21 expect(SERVER_ENTRYPOINT).not.toContain("aws-server");
22 });
23
24 it("rejects a user-declared adapter at astro:config:done", () => {
25 const integration = distilledNode();
26 const setup = integration.hooks["astro:config:setup"];
27 expect(setup).toBeTypeOf("function");
28 const done = integration.hooks["astro:config:done"];
29 expect(done).toBeTypeOf("function");
30 expect(() =>
31 (done as (ctx: never) => void)({
32 setAdapter: () => {},
33 config: {
34 adapter: { name: "@astrojs/node" },
35 build: { serverEntry: "entry.mjs" },
36 },
37 buildOutput: "server",
38 } as never),
39 ).toThrow(/already provides the Node adapter/);
40 });
41
42 it("exposes the named `target` module export as the factory", () => {
43 expect(target).toBe(makeNodeTarget);
44 });
45 });