import { describe, expect, it } from "vitest";
import { getFarmProfileMissingFields, isFarmProfileComplete } from "./farm-profile-validation";

const complete = {
  fullName: "Test Farmer",
  dateOfBirth: "1985-03-15",
  gender: "male",
  region: "tashkent_region",
  district: "zangiota",
  farmerType: "owner",
  householdSize: "5",
  yearsFarming: "10",
  education: "secondary",
};

describe("isFarmProfileComplete", () => {
  it("returns true when all required fields are present", () => {
    expect(isFarmProfileComplete(complete)).toBe(true);
  });

  it("returns false when dateOfBirth is missing", () => {
    expect(isFarmProfileComplete({ ...complete, dateOfBirth: "" })).toBe(false);
  });

  it("returns false when education is missing", () => {
    expect(isFarmProfileComplete({ ...complete, education: "" })).toBe(false);
  });

  it("returns false when district is missing", () => {
    expect(isFarmProfileComplete({ ...complete, district: "" })).toBe(false);
  });

  it("lists missing required fields", () => {
    expect(getFarmProfileMissingFields({ ...complete, education: "", region: "" })).toEqual([
      "region",
      "education",
    ]);
  });
});
