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,187 +0,0 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import {
|
||||
CINEMAS,
|
||||
findCinemaBySlug,
|
||||
hasVenue,
|
||||
listOtherCinemas,
|
||||
type Cinema,
|
||||
filterAdminCinemas,
|
||||
setVenueForSlugs,
|
||||
venueCounts,
|
||||
} from "./cinemas";
|
||||
import { filterCinemas } from "./search";
|
||||
|
||||
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",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("hasVenue / filterCinemas (ชั้นกรองประเภทโรงหนัง)", () => {
|
||||
const base = {
|
||||
slug: "x",
|
||||
name: "X",
|
||||
tags: ["อาร์ตเฮาส์"],
|
||||
location_label: "",
|
||||
coordinates: null,
|
||||
description: "",
|
||||
map_url: null,
|
||||
address_lines: [],
|
||||
transport: [],
|
||||
contacts: [],
|
||||
payments: [],
|
||||
photos: [],
|
||||
} as Cinema;
|
||||
|
||||
const local: Cinema = {
|
||||
...base,
|
||||
slug: "local",
|
||||
venue_type: "โรงภาพยนตร์ท้องถิ่น",
|
||||
};
|
||||
const indie: Cinema = { ...base, slug: "indie", venue_type: "โรงภาพยนตร์อินดี้" };
|
||||
const group: Cinema = { ...base, slug: "group", venue_type: "กลุ่มคนฉายหนัง" };
|
||||
const unset: Cinema = { ...base, slug: "unset" };
|
||||
|
||||
it("hasVenue: null = ไม่กรอง", () => {
|
||||
expect(hasVenue(local, null)).toBe(true);
|
||||
expect(hasVenue(unset, null)).toBe(true);
|
||||
});
|
||||
|
||||
it("hasVenue: ตรงประเภทเท่านั้น", () => {
|
||||
expect(hasVenue(local, "โรงภาพยนตร์ท้องถิ่น")).toBe(true);
|
||||
expect(hasVenue(local, "โรงภาพยนตร์อินดี้")).toBe(false);
|
||||
expect(hasVenue(unset, "โรงภาพยนตร์อินดี้")).toBe(false);
|
||||
});
|
||||
|
||||
it("filterCinemas กรองตามประเภทได้", () => {
|
||||
const all = [local, indie, group, unset];
|
||||
expect(
|
||||
filterCinemas(all, {
|
||||
category: "ทั้งหมด",
|
||||
query: "",
|
||||
venue: "โรงภาพยนตร์อินดี้",
|
||||
}),
|
||||
).toEqual([indie]);
|
||||
expect(
|
||||
filterCinemas(all, {
|
||||
category: "ทั้งหมด",
|
||||
query: "",
|
||||
venue: "กลุ่มคนฉายหนัง",
|
||||
}),
|
||||
).toEqual([group]);
|
||||
expect(filterCinemas(all, { category: "ทั้งหมด", query: "" })).toHaveLength(
|
||||
4,
|
||||
);
|
||||
});
|
||||
|
||||
it("กรองประเภท + หมวดซ้อนกันได้ (AND)", () => {
|
||||
expect(
|
||||
filterCinemas([local, indie], {
|
||||
category: "อาร์ตเฮาส์",
|
||||
query: "",
|
||||
venue: "โรงภาพยนตร์ท้องถิ่น",
|
||||
}),
|
||||
).toEqual([local]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("หลังบ้าน: ตัวกรองประเภทโรงหนัง", () => {
|
||||
const base = {
|
||||
slug: "base",
|
||||
name: "X",
|
||||
tags: [],
|
||||
location_label: "",
|
||||
coordinates: null,
|
||||
description: "",
|
||||
map_url: null,
|
||||
address_lines: [],
|
||||
transport: [],
|
||||
contacts: [],
|
||||
payments: [],
|
||||
photos: [],
|
||||
} as Cinema;
|
||||
const list: Cinema[] = [
|
||||
{
|
||||
...base,
|
||||
slug: "a-local",
|
||||
name: "Alpha",
|
||||
name_th: "อัลฟา",
|
||||
venue_type: "โรงภาพยนตร์ท้องถิ่น",
|
||||
},
|
||||
{ ...base, slug: "b-indie", name: "Beta", venue_type: "โรงภาพยนตร์อินดี้" },
|
||||
{ ...base, slug: "c-group", name: "Gamma", venue_type: "กลุ่มคนฉายหนัง" },
|
||||
{ ...base, slug: "d-none", name: "Delta" },
|
||||
];
|
||||
|
||||
it("กรอง all / unset / แต่ละประเภท", () => {
|
||||
expect(filterAdminCinemas(list, { venue: "all", query: "" })).toHaveLength(
|
||||
4,
|
||||
);
|
||||
expect(
|
||||
filterAdminCinemas(list, { venue: "unset", query: "" }).map(
|
||||
(c) => c.slug,
|
||||
),
|
||||
).toEqual(["d-none"]);
|
||||
expect(
|
||||
filterAdminCinemas(list, { venue: "โรงภาพยนตร์อินดี้", query: "" }).map(
|
||||
(c) => c.slug,
|
||||
),
|
||||
).toEqual(["b-indie"]);
|
||||
});
|
||||
|
||||
it("ค้นด้วยชื่อไทย/อังกฤษ/slug ร่วมกับตัวกรอง", () => {
|
||||
expect(
|
||||
filterAdminCinemas(list, { venue: "all", query: "อัลฟา" }).map(
|
||||
(c) => c.slug,
|
||||
),
|
||||
).toEqual(["a-local"]);
|
||||
expect(
|
||||
filterAdminCinemas(list, { venue: "โรงภาพยนตร์ท้องถิ่น", query: "beta" }),
|
||||
).toHaveLength(0);
|
||||
expect(
|
||||
filterAdminCinemas(list, { venue: "all", query: " GAMMA " })[0]?.slug,
|
||||
).toBe("c-group");
|
||||
});
|
||||
|
||||
it("setVenueForSlugs ตั้งค่าเฉพาะ slug ที่ระบุ และไม่แก้ตัวเดิม", () => {
|
||||
const next = setVenueForSlugs(list, ["d-none", "b-indie"], "กลุ่มคนฉายหนัง");
|
||||
expect(next.find((c) => c.slug === "d-none")?.venue_type).toBe(
|
||||
"กลุ่มคนฉายหนัง",
|
||||
);
|
||||
expect(next.find((c) => c.slug === "b-indie")?.venue_type).toBe(
|
||||
"กลุ่มคนฉายหนัง",
|
||||
);
|
||||
expect(next.find((c) => c.slug === "a-local")?.venue_type).toBe(
|
||||
"โรงภาพยนตร์ท้องถิ่น",
|
||||
);
|
||||
expect(list.find((c) => c.slug === "d-none")?.venue_type).toBeUndefined();
|
||||
expect(setVenueForSlugs(list, [], "โรงภาพยนตร์อินดี้")).toBe(list);
|
||||
});
|
||||
|
||||
it("venueCounts นับครบทุกช่อง", () => {
|
||||
expect(venueCounts(list)).toEqual({
|
||||
all: 4,
|
||||
unset: 1,
|
||||
โรงภาพยนตร์ท้องถิ่น: 1,
|
||||
โรงภาพยนตร์อินดี้: 1,
|
||||
กลุ่มคนฉายหนัง: 1,
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user