import { describe, it, expect } from "vitest";
import { generateNonce } from "@/security/nonce";

describe("generateNonce", () => {
  it("returns a string", () => {
    expect(typeof generateNonce()).toBe("string");
  });

  it("returns base64-encoded 16-byte value", () => {
    const nonce = generateNonce();
    expect(Buffer.from(nonce, "base64").length).toBe(16);
  });

  it("returns different values on successive calls", () => {
    const n1 = generateNonce();
    const n2 = generateNonce();
    expect(n1).not.toBe(n2);
  });
});
