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

const signInMock = vi.hoisted(() => vi.fn());

vi.mock("next-auth/react", () => ({
  signIn: signInMock,
}));

import { AuthPlatform } from "../auth_platform";

describe("AuthPlatform", () => {
  beforeEach(() => {
    signInMock.mockReset();
    signInMock.mockResolvedValue(undefined);
  });

  it("requests only public profile for Facebook login", async () => {
    await AuthPlatform.facebookSignIn();

    expect(signInMock).toHaveBeenCalledWith("facebook", undefined, {
      scope: "public_profile",
    });
  });

  it("keeps Google login unchanged", async () => {
    await AuthPlatform.googleSignIn();

    expect(signInMock).toHaveBeenCalledWith("google");
  });
});
