import { describe, expect, it, vi } from "vitest";
import { logoutAndSwitchAccount } from "../client/src/lib/account-actions";

describe("logoutAndSwitchAccount", () => {
  it("logs out before redirecting to the account entry point", async () => {
    const calls: string[] = [];
    const logout = vi.fn(async () => {
      calls.push("logout");
      return { success: true };
    });
    const redirect = vi.fn((path: string) => calls.push(`redirect:${path}`));

    await logoutAndSwitchAccount(logout, redirect);

    expect(calls).toEqual(["logout", "redirect:/"]);
  });
});
