import { describe, expect, it } from "vitest";
import { RUST_WEB_MAIN_EXECUTION_BOUNDARY } from "./rust-web-main-execution-boundary";

describe("RUST_WEB_MAIN_EXECUTION_BOUNDARY", () => {
  it("固定 3000 公开入口由 mnote-web 拥有，Next 只能作为 legacy compat", () => {
    expect(RUST_WEB_MAIN_EXECUTION_BOUNDARY.publicEntry).toBe("3000");
    expect(RUST_WEB_MAIN_EXECUTION_BOUNDARY.mainWebOwner).toBe("mnote-web");
    expect(RUST_WEB_MAIN_EXECUTION_BOUNDARY.legacyCompatOwner).toBe("next-app-router");
    expect(RUST_WEB_MAIN_EXECUTION_BOUNDARY.nextAllowedDuties).not.toContain("main_web_owner");
    expect(RUST_WEB_MAIN_EXECUTION_BOUNDARY.forbiddenNextSemantics).toContain("主 Web gateway owner");
  });

  it("把主 Web 执行面和允许保留的 React island / legacy bundle 明确分层", () => {
    expect(RUST_WEB_MAIN_EXECUTION_BOUNDARY.rustOwnedPlanes).toEqual(
      expect.arrayContaining([
        "web_gateway",
        "document_shell",
        "page_aggregate_transport",
        "tree_realtime_stream",
        "search_shell",
        "ai_bridge_transport",
        "mindmap_object_shell",
      ]),
    );
    expect(RUST_WEB_MAIN_EXECUTION_BOUNDARY.nextAllowedDuties).toEqual([
      "legacy_react_bundle",
      "legacy_app_router_compat",
      "island_asset_source_until_migrated",
    ]);
  });
});
