1import { describe, expect, it } from "vitest";
2import { NODE_BUNDLE_CONDITIONS } from "../../core/NodeServe.ts";
3import { ADAPTER_NAME as MARKER_NAME, node } from "../node-adapter.ts";
4import {
5 ADAPTER_NAME,
6 ADAPTER_PACKAGE,
7 SERVER_ENTRY_FILE_NAME,
8 makeNodeTarget,
9 target,
10} from "../node.ts";
11
12describe("makeNodeTarget", () => {
13 it("accepts native Node output without an application adapter", () => {
14 const nodeTarget = makeNodeTarget({ compatibilityDate: "2026-03-10" });
15 expect(nodeTarget.platform).toBe("node");
16 expect(nodeTarget.requiresAdapter).not.toBe(true);
17 expect(nodeTarget.adapterName).toBe(ADAPTER_NAME);
18 expect(nodeTarget.adapterPackage).toBe(ADAPTER_PACKAGE);
19 expect(nodeTarget.serverEntryFileName).toBe(SERVER_ENTRY_FILE_NAME);
20 expect(SERVER_ENTRY_FILE_NAME).toBe("entry.js");
21 expect(nodeTarget.bundle?.conditions).toEqual([...NODE_BUNDLE_CONDITIONS]);
22 expect(nodeTarget.finish).toBeTypeOf("function");
23 expect(nodeTarget.build).toBeTypeOf("function");
24 });
25
26 it("exposes a dependency-free marker adapter named node", () => {
27 expect(MARKER_NAME).toBe("node");
28 expect(node()).toEqual({ name: "node", serverTarget: "node" });
29 expect(ADAPTER_PACKAGE).toBe(
30 "@alchemy.run/frontend-frameworks/octane/node-adapter",
31 );
32 });
33
34 it("exposes the named `target` module export as the factory", () => {
35 expect(target).toBe(makeNodeTarget);
36 });
37});