import { describe, it, expect } from "vitest";
import { exposeRouterId } from "../expose-internal-ids.ts";
function createPlugin() {
    const plugin = exposeRouterId();
    return plugin;
}
describe("exposeRouterId", () => {
    it("injects router id when createRouter is imported with alias", () => {
        const plugin = createPlugin();
        plugin.configResolved({ root: "/project" });
        const code = `import { createRouter as cr } from "@rangojs/router";
const router = cr({});
`;
        const result = plugin.transform(code, "/project/src/router.tsx");
        expect(result).toBeDefined();
        expect(result.code).toContain("$$id");
        expect(result.code).toContain("$$routeNames");
    });
    it("returns null when createRouter is not imported from @rangojs/router", () => {
        const plugin = createPlugin();
        plugin.configResolved({ root: "/project" });
        const code = `const router = createRouter({});`;
        const result = plugin.transform(code, "/project/src/router.tsx");
        expect(result).toBeNull();
    });
    it("injects router id when createRouter call is exported via specifier alias", () => {
        const plugin = createPlugin();
        plugin.configResolved({ root: "/project" });
        const code = `import { createRouter as cr } from "@rangojs/router";
const routerDef = cr({});
export { routerDef as router };
`;
        const result = plugin.transform(code, "/project/src/router.tsx");
        expect(result).toBeDefined();
        expect(result.code).toContain("$$id");
        expect(result.code).toContain("$$routeNames");
    });
});
//# sourceMappingURL=expose-router-id.test.js.map