import { describe, it, expect } from "vitest";
import {
  POPULATION_1KK,
  POPULATION_500K,
  POPULATION_100K,
  POPULAR_RESORTS,
  getCityZoomLevel,
} from "./cityCategory.js";

describe("cityCategory — set sizes", () => {
  it("POPULATION_1KK has 30 entries (Angular parity)", () => {
    expect(POPULATION_1KK.size).toBe(30);
  });

  it("POPULATION_500K has 23 entries", () => {
    expect(POPULATION_500K.size).toBe(23);
  });

  it("POPULATION_100K has 39 entries", () => {
    expect(POPULATION_100K.size).toBe(39);
  });

  it("POPULAR_RESORTS has 15 entries", () => {
    expect(POPULAR_RESORTS.size).toBe(15);
  });
});

describe("cityCategory — membership spot checks", () => {
  it("MOW is in POPULATION_1KK", () => {
    expect(POPULATION_1KK.has("MOW")).toBe(true);
  });

  it("DXB is in POPULAR_RESORTS", () => {
    expect(POPULAR_RESORTS.has("DXB")).toBe(true);
  });

  it("TJM is in POPULATION_500K", () => {
    expect(POPULATION_500K.has("TJM")).toBe(true);
  });

  it("MMK is in POPULATION_100K", () => {
    expect(POPULATION_100K.has("MMK")).toBe(true);
  });
});

describe("getCityZoomLevel", () => {
  it("returns 2 for a 1kk-population city", () => {
    expect(getCityZoomLevel("MOW")).toBe(2);
  });

  it("returns 2 for a popular resort", () => {
    expect(getCityZoomLevel("DXB")).toBe(2);
  });

  it("returns 5 for a 500k-population city", () => {
    expect(getCityZoomLevel("TJM")).toBe(5);
  });

  it("returns 6 for a 100k-population city", () => {
    expect(getCityZoomLevel("MMK")).toBe(6);
  });

  it("returns 6 for an unknown city code", () => {
    expect(getCityZoomLevel("XXX")).toBe(6);
  });
});
