import { describe, it, expect, vi, beforeEach } from "vitest";

const invoke = vi.fn();
vi.mock("@tauri-apps/api/core", () => ({
  invoke: (...args: unknown[]) => invoke(...args),
}));

import { TauriPluginGateway } from "./plugin";

describe("TauriPluginGateway invoke payloads", () => {
  beforeEach(() => invoke.mockReset().mockResolvedValue({}));

  it("reviewPackage sends the package DTO under the Tauri input arg", async () => {
    await new TauriPluginGateway().reviewPackage({
      sourceKind: "archive",
      path: "/tmp/example.ideaplug",
    });

    expect(invoke).toHaveBeenCalledWith("plugin_review_package", {
      input: {
        sourceKind: "archive",
        path: "/tmp/example.ideaplug",
      },
    });
  });
});
