@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 38 lines 1.48 KB
Raw
1 import * as NodePath from "node:path";
2 import * as Effect from "effect/Effect";
3 import { describe, expect, it } from "vitest";
4 import { isDeployTarget } from "../../core/index.ts";
5 import { NODE_BUNDLE_CONDITIONS } from "../../core/NodeServe.ts";
6 import { makeNodeTarget, target } from "../node.ts";
7
8 const context = {
9 root: "/project",
10 wakuDirectory: "/project/node_modules/waku",
11 phase: "build" as const,
12 };
13
14 describe("makeNodeTarget", () => {
15 it("declares the node platform, empty vite plugins, and a finish pass", async () => {
16 const node = makeNodeTarget();
17 expect(isDeployTarget(node)).toBe(true);
18 expect(node.platform).toBe("node");
19 expect(node.bundle?.conditions).toEqual([...NODE_BUNDLE_CONDITIONS]);
20 expect(node.bundle?.external ?? []).not.toContain("cloudflare:");
21 expect(node.build).toBeTypeOf("function");
22 expect(node.finish).toBeTypeOf("function");
23 const plugins = await Effect.runPromise(node.vitePlugins(context));
24 expect(plugins).toEqual([]);
25 });
26
27 it("selects waku's node adapter from the project's waku package", async () => {
28 const node = makeNodeTarget();
29 const adapter = await Effect.runPromise(node.adapter(context));
30 expect(adapter).toBe(NodePath.join(context.wakuDirectory, "dist/adapters/node.js"));
31 expect(adapter).not.toContain("aws-adapter");
32 expect(adapter).not.toContain("cloudflare");
33 });
34
35 it("exposes the named `target` module export as the factory", () => {
36 expect(target).toBe(makeNodeTarget);
37 });
38 });