chore(publish): replace source tree with static export at repo root
Publish the prerendered static export (index.html, 404.html, cinema/,
c/, about/, for-cinemas/, for-film-lovers/, assets/, images/, og/,
sitemap.xml, robots.txt) as the site root and remove the React Router
+ Nitro source tree from this branch. Source remains available in
history at 0548772.
Note: public/sw.js here reports VERSION v2.0.5 while the removed source
tree (v2.1.0) was newer, and .gitignore was not carried over.
This commit is contained in:
1 parent
05487728a7
commit
e6c4ebff48
394 files changed
+3977
-37891
No files matched your search
@@ -1,83 +0,0 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import type { Cinema } from "@/lib/cinemas";
|
||||
import {
|
||||
cinemaFacilities,
|
||||
listOtherCinemas,
|
||||
publiclyVisible,
|
||||
} from "@/lib/cinemas";
|
||||
import { filterCinemas } from "@/lib/search";
|
||||
|
||||
/**
|
||||
* สเปกของกติกาที่เพิ่มเข้ามา: ซ่อนโรง (hidden) + สิ่งอำนวยความสะดวกต่อโรง
|
||||
*/
|
||||
|
||||
function cinema(slug: string, patch: Partial<Cinema> = {}): Cinema {
|
||||
return {
|
||||
slug,
|
||||
name: slug.toUpperCase(),
|
||||
name_th: slug,
|
||||
tags: [],
|
||||
location_label: "",
|
||||
coordinates: null,
|
||||
description: "",
|
||||
map_url: null,
|
||||
address_lines: [],
|
||||
transport: [],
|
||||
contacts: [],
|
||||
payments: [],
|
||||
photos: [],
|
||||
...patch,
|
||||
};
|
||||
}
|
||||
|
||||
describe("cinemaFacilities", () => {
|
||||
it("คืนเฉพาะหัวข้อที่มี และเรียงตาม FACILITY_KEYS", () => {
|
||||
const c = cinema("a", { facilities: ["cafe", "seating"] });
|
||||
expect(cinemaFacilities(c)).toEqual(["seating", "cafe"]);
|
||||
});
|
||||
|
||||
it("ข้อมูลเก่าที่ไม่มีฟิลด์ → อาร์เรย์ว่าง", () => {
|
||||
expect(cinemaFacilities(cinema("b"))).toEqual([]);
|
||||
});
|
||||
|
||||
it("ตัดคีย์ที่ไม่รู้จักทิ้ง", () => {
|
||||
const c = cinema("c", { facilities: ["seating", "unknown" as never] });
|
||||
expect(cinemaFacilities(c)).toEqual(["seating"]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("publiclyVisible", () => {
|
||||
it("ตัดโรงที่ hidden ออก", () => {
|
||||
const list = [cinema("a"), cinema("b", { hidden: true }), cinema("c")];
|
||||
expect(publiclyVisible(list).map((item) => item.slug)).toEqual(["a", "c"]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("filterCinemas + hidden", () => {
|
||||
it("ตัวกรองหมวดไม่คืนโรงที่ถูกซ่อน (เพราะกรองจากลิสต์ที่ผ่าน publiclyVisible)", () => {
|
||||
const list = [
|
||||
cinema("show", { tags: ["อาร์ตเฮาส์"] }),
|
||||
cinema("hide", { tags: ["อาร์ตเฮาส์"], hidden: true }),
|
||||
];
|
||||
const result = filterCinemas(publiclyVisible(list), { category: "อาร์ตเฮาส์", query: "" });
|
||||
expect(result.map((item) => item.slug)).toEqual(["show"]);
|
||||
});
|
||||
|
||||
it("ค้นหาจากชื่อ/ที่ตั้ง ยังทำงาน", () => {
|
||||
const list = [cinema("x", { location_label: "จังหวัดพะเยา" })];
|
||||
expect(filterCinemas(list, { category: "ทั้งหมด", query: "พะเยา" })).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe("listOtherCinemas", () => {
|
||||
it("ไม่คืนตัวเอง และไม่คืนโรงที่ซ่อน", () => {
|
||||
const list = [cinema("a"), cinema("b", { hidden: true }), cinema("c")];
|
||||
expect(listOtherCinemas(list, "a").map((item) => item.slug)).toEqual(["c"]);
|
||||
});
|
||||
|
||||
it("จำกัดจำนวนตาม limit", () => {
|
||||
const list = [cinema("a"), cinema("b"), cinema("c"), cinema("d")];
|
||||
expect(listOtherCinemas(list, "a", 2)).toHaveLength(2);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user