import { readFileSync } from "node:fs";
import { join } from "node:path";
import { describe, expect, test } from "vitest";

const ROOT = join(import.meta.dirname, "..");
const GATE_CALLSITE_FILES = [
	"auto/phases-pre-dispatch.js",
	"auto/phases-dispatch.js",
	"uok/auto-dispatch.js",
];

describe("uok gate type call sites", () => {
	test("gate_call_sites_when_registering_or_emitting_do_not_use_execution_as_gate_type", () => {
		for (const rel of GATE_CALLSITE_FILES) {
			const source = readFileSync(join(ROOT, rel), "utf8");
			expect(source, rel).not.toMatch(/gateType:\s*["']execution["']/);
			expect(source, rel).not.toMatch(/type:\s*["']execution["']/);
		}
	});
});
