import { describe, expect, it } from "vitest";
import { goService, nextService, tsxService } from "./index.mjs";

describe("setup helpers", () => {
  it("emits plain next start commands without an exec prefix", () => {
    const config = nextService({ port: 3000 });

    expect(config.local.start).toBe("./node_modules/.bin/next dev -p {port}");
  });

  it("emits plain tsx start commands without an exec prefix", () => {
    const config = tsxService({ port: 3000, entry: "src/server.ts" });

    expect(config.local.start).toBe("./node_modules/.bin/tsx watch src/server.ts");
  });

  it("emits plain go start commands without an exec prefix", () => {
    expect(goService({ port: 3000 }).local.start).toBe("go run ./cmd/server");
    expect(goService({ port: 3000, entrypoint: "./cmd/api" }).local.start).toBe(
      "go run ./cmd/api"
    );
    expect(goService({ port: 3000, command: "./cmd/worker" }).local.start).toBe(
      "go run ./cmd/worker"
    );
  });
});
