import { describe, it, expect } from "vitest";
import { hashPassword, verifyPassword } from "./password";

describe("password", () => {
  it("should hash a password", async () => {
    const hash = await hashPassword("secure-password");
    expect(hash).toBeTruthy();
    expect(hash).not.toBe("secure-password");
  });

  it("should verify correct password", async () => {
    const hash = await hashPassword("secure-password");
    const valid = await verifyPassword("secure-password", hash);
    expect(valid).toBe(true);
  });

  it("should reject wrong password", async () => {
    const hash = await hashPassword("secure-password");
    const valid = await verifyPassword("wrong-password", hash);
    expect(valid).toBe(false);
  });
});
