import { describe, expect, it } from "vitest"; import { findCinemaBySlug, listOtherCinemas, CINEMAS, } from "./cinemas"; describe("findCinemaBySlug", () => { it("คืน undefined เมื่อไม่ได้ส่ง slug", () => { expect(findCinemaBySlug(CINEMAS, undefined)).toBeUndefined(); }); it("คืนโรงหนังตาม slug", () => { expect(findCinemaBySlug(CINEMAS, "house-cinema-samyan")?.name).toBe( "HOUSE CINEMA SAMYAN", ); }); }); describe("listOtherCinemas", () => { it("ไม่รวมโรงหนังปัจจุบันและไม่เกิน limit", () => { const others = listOtherCinemas(CINEMAS, "house-cinema-samyan", 4); expect(others).toHaveLength(4); expect(others.map((cinema) => cinema.slug)).not.toContain( "house-cinema-samyan", ); }); });