import { describe, expect, it } from "vitest";
import { optima } from "./index";

describe("optima aggregate export", () => {
  it("exports all expected API modules", () => {
    expect(optima).toBeDefined();
    expect(optima.auth).toBeDefined();
    expect(optima.company).toBeDefined();
    expect(optima.credential).toBeDefined();
    expect(optima.credentialType).toBeDefined();
    expect(optima.role).toBeDefined();
    expect(optima.permission).toBeDefined();
    expect(optima.user).toBeDefined();
    expect(optima.users).toBeDefined();
    expect(optima.unifi).toBeDefined();
    expect(optima.procurement).toBeDefined();
    expect(optima.sales).toBeDefined();
    expect(optima.cw).toBeDefined();
  });

  it("auth module has fetchAuthRedirectUri", () => {
    expect(typeof optima.auth.fetchAuthRedirectUri).toBe("function");
  });

  it("user module has expected methods", () => {
    expect(typeof optima.user.isLoggedIn).toBe("function");
    expect(typeof optima.user.refreshSession).toBe("function");
    expect(typeof optima.user.fetchInfo).toBe("function");
    expect(typeof optima.user.logout).toBe("function");
    expect(typeof optima.user.checkPermissions).toBe("function");
    expect(typeof optima.user.awaitAuthCallback).toBe("function");
  });

  it("cw module has fetchMembers", () => {
    expect(typeof optima.cw.fetchMembers).toBe("function");
  });
});
