mirror of
https://github.com/moltbot/moltbot.git
synced 2026-05-08 16:56:09 +00:00
Merged via squash.
Prepared head SHA: 31cbc3349c
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Reviewed-by: @mbelinky
42 lines
1.5 KiB
TypeScript
42 lines
1.5 KiB
TypeScript
import path from "node:path";
|
|
import { describe, expect, it } from "vitest";
|
|
import {
|
|
buildGatewayInstallEntrypointCandidates as resolveGatewayInstallEntrypointCandidates,
|
|
resolveGatewayInstallEntrypoint,
|
|
} from "../../daemon/gateway-entrypoint.js";
|
|
|
|
describe("resolveGatewayInstallEntrypointCandidates", () => {
|
|
it("prefers index.js before legacy entry.js", () => {
|
|
expect(resolveGatewayInstallEntrypointCandidates("/tmp/openclaw-root")).toEqual([
|
|
path.join("/tmp/openclaw-root", "dist", "index.js"),
|
|
path.join("/tmp/openclaw-root", "dist", "index.mjs"),
|
|
path.join("/tmp/openclaw-root", "dist", "entry.js"),
|
|
path.join("/tmp/openclaw-root", "dist", "entry.mjs"),
|
|
]);
|
|
});
|
|
});
|
|
|
|
describe("resolveGatewayInstallEntrypoint", () => {
|
|
it("prefers dist/index.js over dist/entry.js when both exist", async () => {
|
|
const root = "/tmp/openclaw-root";
|
|
const indexPath = path.join(root, "dist", "index.js");
|
|
const entryPath = path.join(root, "dist", "entry.js");
|
|
|
|
await expect(
|
|
resolveGatewayInstallEntrypoint(
|
|
root,
|
|
async (candidate) => candidate === indexPath || candidate === entryPath,
|
|
),
|
|
).resolves.toBe(indexPath);
|
|
});
|
|
|
|
it("falls back to dist/entry.js when index.js is missing", async () => {
|
|
const root = "/tmp/openclaw-root";
|
|
const entryPath = path.join(root, "dist", "entry.js");
|
|
|
|
await expect(
|
|
resolveGatewayInstallEntrypoint(root, async (candidate) => candidate === entryPath),
|
|
).resolves.toBe(entryPath);
|
|
});
|
|
});
|