import "./setup-env.js";
import { describe, expect, it } from "vitest";
import { t } from "../src/lib/i18n.js";

describe("server i18n", () => {
  it("returns locale-specific household default name", () => {
    expect(t("onboarding.householdDefaultName", "sv-SE")).toBe("Hemma");
    expect(t("onboarding.householdDefaultName", "en-US")).toBe("Home");
    expect(t("onboarding.householdDefaultName", "pl-PL")).toBe("Dom");
  });

  it("falls back to English for unsupported languages", () => {
    expect(t("onboarding.householdDefaultName", "xx-XX")).toBe("Home");
    expect(t("onboarding.householdDefaultName", "jp")).toBe("Home");
  });

  it("never returns the key string as value", () => {
    const result = t("onboarding.householdDefaultName", "zz");
    expect(result).not.toBe("onboarding.householdDefaultName");
    expect(result.length).toBeGreaterThan(0);
  });
});
