/**
 * #343 — admin-utils 순수 함수 단위 테스트.
 */
import { getAdminToken, authHeaders } from "@/lib/admin-utils";

describe("admin-utils", () => {
  beforeEach(() => {
    localStorage.clear();
  });

  it("getAdminToken returns null when not set", () => {
    expect(getAdminToken()).toBeNull();
  });

  it("getAdminToken returns stored token", () => {
    localStorage.setItem("tasteby_token", "abc123");
    expect(getAdminToken()).toBe("abc123");
  });

  it("authHeaders is empty when no token", () => {
    expect(authHeaders()).toEqual({});
  });

  it("authHeaders includes Bearer when token set", () => {
    localStorage.setItem("tasteby_token", "xyz");
    expect(authHeaders()).toEqual({ Authorization: "Bearer xyz" });
  });
});
