import { describe, it, expect } from "vitest";
import { inarikoSeasons } from "../src/data/weather/regions/inarikoSeasons.ts";
import { rudaniaSeasons } from "../src/data/weather/regions/rudaniaSeasons.ts";
import { vhintlSeasons } from "../src/data/weather/regions/vhintlSeasons.ts";

describe("region Tests", () => {
  describe("inariko", () => {
    it("seasons should be unique", () => {
      const seasons = new Set(inarikoSeasons.map((element) => {
        return element.season;
      }));
      expect(seasons.size, "seasons are not unique!").toBe(
        inarikoSeasons.length,
      );
    });

    for (const season of inarikoSeasons) {
      it(`${season.season} should have unique temps`, () => {
        const temps = new Set(season.temps);
        expect(temps.size, `${season.season} temps are not unique!`).toBe(
          season.temps.length,
        );
      });

      it(`${season.season} should have unique winds`, () => {
        const winds = new Set(season.wind);
        expect(winds.size, `${season.season} winds are not unique!`).toBe(
          season.wind.length,
        );
      });

      it(`${season.season} should have unique precipitation`, () => {
        const precipitation = new Set(season.precipitation);
        expect(
          precipitation.size,
          `${season.season} precipitation is not unique!`,
        ).toBe(season.precipitation.length);
      });

      it(`${season.season} should have unique specials`, () => {
        const specials = new Set(season.special);
        expect(specials.size, `${season.season} specials are not unique!`).toBe(
          season.special.length,
        );
      });
    }
  });

  describe("rudania", () => {
    it("seasons should be unique", () => {
      const seasons = new Set(rudaniaSeasons.map((element) => {
        return element.season;
      }));
      expect(seasons.size, "seasons are not unique!").toBe(
        rudaniaSeasons.length,
      );
    });

    for (const season of rudaniaSeasons) {
      it(`${season.season} should have unique temps`, () => {
        const temps = new Set(season.temps);
        expect(temps.size, `${season.season} temps are not unique!`).toBe(
          season.temps.length,
        );
      });

      it(`${season.season} should have unique winds`, () => {
        const winds = new Set(season.wind);
        expect(winds.size, `${season.season} winds are not unique!`).toBe(
          season.wind.length,
        );
      });

      it(`${season.season} should have unique precipitation`, () => {
        const precipitation = new Set(season.precipitation);
        expect(
          precipitation.size,
          `${season.season} precipitation is not unique!`,
        ).toBe(season.precipitation.length);
      });

      it(`${season.season} should have unique specials`, () => {
        const specials = new Set(season.special);
        expect(specials.size, `${season.season} specials are not unique!`).toBe(
          season.special.length,
        );
      });
    }
  });

  describe("vhintl", () => {
    it("seasons should be unique", () => {
      const seasons = new Set(vhintlSeasons.map((element) => {
        return element.season;
      }));
      expect(seasons.size, "seasons are not unique!").toBe(
        vhintlSeasons.length,
      );
    });

    for (const season of vhintlSeasons) {
      it(`${season.season} should have unique temps`, () => {
        const temps = new Set(season.temps);
        expect(temps.size, `${season.season} temps are not unique!`).toBe(
          season.temps.length,
        );
      });

      it(`${season.season} should have unique winds`, () => {
        const winds = new Set(season.wind);
        expect(winds.size, `${season.season} winds are not unique!`).toBe(
          season.wind.length,
        );
      });

      it(`${season.season} should have unique precipitation`, () => {
        const precipitation = new Set(season.precipitation);
        expect(
          precipitation.size,
          `${season.season} precipitation is not unique!`,
        ).toBe(season.precipitation.length);
      });

      it(`${season.season} should have unique specials`, () => {
        const specials = new Set(season.special);
        expect(specials.size, `${season.season} specials are not unique!`).toBe(
          season.special.length,
        );
      });
    }
  });
});
