weather.test.ts 1005 B

1234567891011121314151617181920212223242526
  1. import { describe, expect, it } from "vitest";
  2. import { weatherEffects } from "../src/weather.js";
  3. describe("weatherEffects (pure weather-id → visual mapping)", () => {
  4. it("maps rain to the rain particle + rain-tint filter", () => {
  5. expect(weatherEffects("rain")).toEqual({ particleId: "rain", filterId: "rain-tint" });
  6. });
  7. it("maps storm to rain particles + the tint filter + the storm overlay color", () => {
  8. expect(weatherEffects("storm")).toEqual({ particleId: "rain", filterId: "rain-tint", color: "#2f3b4c" });
  9. });
  10. it("maps wind to the wind particle with no filter", () => {
  11. expect(weatherEffects("wind")).toEqual({ particleId: "wind" });
  12. });
  13. it("maps sunny and snow to no visuals", () => {
  14. expect(weatherEffects("sunny")).toEqual({});
  15. expect(weatherEffects("snow")).toEqual({});
  16. });
  17. it("maps an unknown weather id to {} without crashing", () => {
  18. expect(weatherEffects("blizzard")).toEqual({});
  19. expect(weatherEffects("")).toEqual({});
  20. });
  21. });