import assert from "node:assert";
import { describe, it } from "node:test";
import { hasEnvironmentFlag } from "./get-environment-param.js";
function argv(...userArgs) {
    return ["node", "/path/to/zup.js", ...userArgs];
}
describe("hasEnvironmentFlag", () => {
    it("returns true for `--environment main`", () => {
        assert.strictEqual(hasEnvironmentFlag(argv("deploy", "--environment", "main")), true);
    });
    it("returns true for `--environment=main`", () => {
        assert.strictEqual(hasEnvironmentFlag(argv("deploy", "--environment=main")), true);
    });
    it("returns false for `-e main` because deploy doesn't declare a short alias", () => {
        assert.strictEqual(hasEnvironmentFlag(argv("deploy", "-e", "main")), false);
    });
    it("returns false when no environment flag is present", () => {
        assert.strictEqual(hasEnvironmentFlag(argv("deploy")), false);
    });
    it("returns false when only unrelated flags are present", () => {
        assert.strictEqual(hasEnvironmentFlag(argv("deploy", "--no-prompt", "--account", "foo")), false);
    });
    it("returns false for env-var only (no flag in argv) — this is the case the production prompt must not bypass", () => {
        assert.strictEqual(hasEnvironmentFlag(argv("deploy")), false);
    });
    it("does not match flags that share a prefix (e.g. `--environment-other`)", () => {
        assert.strictEqual(hasEnvironmentFlag(argv("deploy", "--environment-other", "x")), false);
    });
    it("ignores `--environment` if it appears in node/script positions", () => {
        assert.strictEqual(hasEnvironmentFlag(["--environment", "x", "deploy"]), false);
    });
});
//# sourceMappingURL=get-environment-param.test.js.map