import assert from "node:assert/strict";
import { describe, it } from 'vitest';
import { parseArgs } from "./args.js";

describe("parseArgs", () => {
	it("parses optional-value extension flags with implicit and explicit values", () => {
		const extensionFlags = new Map([
			["gemini-cli-proxy", { type: "string" as const, allowNoValue: true }],
		]);
		const defaultFlagArgs = parseArgs(["--gemini-cli-proxy"], extensionFlags);
		const explicitFlagArgs = parseArgs(["--gemini-cli-proxy=8080"], extensionFlags);

		assert.deepEqual(
			[
				defaultFlagArgs.unknownFlags.get("gemini-cli-proxy"),
				explicitFlagArgs.unknownFlags.get("gemini-cli-proxy"),
			],
			[true, "8080"],
		);
	});
});
