generated from nhcarrigan/template
feat: update this highly outdated app to use latest packages and custom configs (#1)
Reviewed-on: https://codeberg.org/nhcarrigan/tingle-bot/pulls/1 Co-authored-by: Naomi Carrigan <commits@nhcarrigan.com> Co-committed-by: Naomi Carrigan <commits@nhcarrigan.com>
This commit is contained in:
132
test/regions.spec.ts
Normal file
132
test/regions.spec.ts
Normal file
@ -0,0 +1,132 @@
|
||||
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,
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
102
test/weather.spec.ts
Normal file
102
test/weather.spec.ts
Normal file
@ -0,0 +1,102 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { precipitations } from "../src/data/weather/precipitations.ts";
|
||||
import { specials } from "../src/data/weather/specials.ts";
|
||||
import { temperatures } from "../src/data/weather/temperatures.ts";
|
||||
import { winds } from "../src/data/weather/winds.ts";
|
||||
|
||||
describe("weather Tests", () => {
|
||||
describe("temperature", () => {
|
||||
const temps = new Set(temperatures.map((element) => {
|
||||
return element.name;
|
||||
}));
|
||||
it("temperatures should be unique", () => {
|
||||
expect(temps.size, "temperatures are not unique!").toBe(
|
||||
temperatures.length,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("winds", () => {
|
||||
const wind = new Set(winds.map((element) => {
|
||||
return element.name;
|
||||
}));
|
||||
it("winds should be unique", () => {
|
||||
expect(wind.size, "winds are not unique!").toBe(winds.length);
|
||||
});
|
||||
});
|
||||
|
||||
describe("precipitations", () => {
|
||||
const precip = new Set(precipitations.map((element) => {
|
||||
return element.name;
|
||||
}));
|
||||
it("precipitations should be unique", () => {
|
||||
expect(precip.size, "precipitations are not unique!").toBe(
|
||||
precipitations.length,
|
||||
);
|
||||
});
|
||||
|
||||
for (const precipitation of precipitations) {
|
||||
it(`${precipitation.name} should have unique temps`, () => {
|
||||
if (precipitation.temps === "any") {
|
||||
return;
|
||||
}
|
||||
const temps = new Set(precipitation.temps);
|
||||
expect(temps.size, `${precipitation.name} temps are not unique!`).toBe(
|
||||
precipitation.temps.length,
|
||||
);
|
||||
});
|
||||
|
||||
it(`${precipitation.name} should have unique winds`, () => {
|
||||
if (precipitation.winds === "any") {
|
||||
return;
|
||||
}
|
||||
const winds = new Set(precipitation.winds);
|
||||
expect(winds.size, `${precipitation.name} winds are not unique!`).toBe(
|
||||
precipitation.winds.length,
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
describe("specials", () => {
|
||||
const spec = new Set(specials.map((element) => {
|
||||
return element.name;
|
||||
}));
|
||||
it("specials should be unique", () => {
|
||||
expect(spec.size, "specials are not unique!").toBe(specials.length);
|
||||
});
|
||||
|
||||
for (const special of specials) {
|
||||
it(`${special.name} should have unique temps`, () => {
|
||||
if (special.temps === "any") {
|
||||
return;
|
||||
}
|
||||
const temps = new Set(special.temps);
|
||||
expect(temps.size, `${special.name} temps are not unique!`).toBe(
|
||||
special.temps.length,
|
||||
);
|
||||
});
|
||||
|
||||
it(`${special.name} should have unique winds`, () => {
|
||||
if (special.winds === "any") {
|
||||
return;
|
||||
}
|
||||
const winds = new Set(special.winds);
|
||||
expect(special.winds, "Special winds are not unique!").toHaveLength(
|
||||
winds.size,
|
||||
);
|
||||
});
|
||||
|
||||
it(`${special.name} should have unique precipitation`, () => {
|
||||
if (special.precipitations === "any") {
|
||||
return;
|
||||
}
|
||||
const precip = new Set(special.precipitations);
|
||||
expect(
|
||||
precip.size,
|
||||
`${special.name} precipitation is not unique!`,
|
||||
).toBe(special.precipitations.length);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user