- บทความจากหลังบ้าน: /for-film-lovers, /for-cinemas (ArticlePage + ArticleEditor แบบบล็อกย่อหน้า/รูป) - แชร์: ปุ่มบนการ์ดและท้ายหน้ารายละเอียด · ลิงก์ย่อ /c/<slug> (302) · ธีมแก้วตาม DESIGN.md - PWA: manifest/sw/offline + ถอดการล็อกซูม (WCAG 1.4.4) + touch target ≥44px - แอนิเมชัน reveal: IntersectionObserver + gate ด้วย html.fx-motion · เคารพ prefers-reduced-motion - ค้นหา: normalize/ตัดวรรณยุกต์ + AND หลายคำ + จัดอันดับ · รองรับ /?q= จาก SearchAction - SEO: pageMeta (canonical/OG/Twitter) + JSON-LD (WebSite/Organization/BreadcrumbList/MovieTheater/Article) - ไม่ฝังโดเมนในโค้ด: origin มาจาก request (x-forwarded-host/proto) ทั้ง canonical, sitemap, robots, ลิงก์แชร์ - กัน AI: robots.txt (Nitro route, บล็อก AI 21 ตัว) + ai.txt + OG image 1200x630 - เอกสาร: README สรุปโปรเจกต์, DESIGN.md (motion/PWA/SEO/ข้อมูล), architecture.html, admin-guide - tests: 135 ผ่าน (16 ไฟล์)
30 lines
874 B
TypeScript
30 lines
874 B
TypeScript
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",
|
|
);
|
|
});
|
|
});
|