import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { join } from "node:path";
import { describe, it } from 'vitest';

const extensionDir = join("src", "resources", "extensions", "genai-proxy");

describe("genai-proxy package metadata", () => {
	it("declares the index.ts extension entrypoint", () => {
		const packageJson = JSON.parse(
			readFileSync(join(extensionDir, "package.json"), "utf-8"),
		) as {
			pi?: { extensions?: string[] };
		};

		assert.deepEqual(packageJson.pi?.extensions, ["./index.ts"]);
	});

	it("declares a bundled extension manifest", () => {
		const manifest = JSON.parse(
			readFileSync(join(extensionDir, "extension-manifest.json"), "utf-8"),
		) as {
			id: string;
			tier: string;
		};

		assert.deepEqual(
			{ id: manifest.id, tier: manifest.tier },
			{ id: "genai-proxy", tier: "bundled" },
		);
	});
});
