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,120 +0,0 @@
|
||||
/**
|
||||
* ทดสอบการจับคู่ลิงก์ของช่องทางติดต่อ — เคสที่พังจริงบนหน้าเว็บ
|
||||
* (เบอร์กดไม่ได้, facebook ติด fbclid, `www.…` ไม่มี scheme, LINE ID)
|
||||
*/
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import {
|
||||
contactHref,
|
||||
looksLikePhone,
|
||||
normalizePhone,
|
||||
resolveContact,
|
||||
} from "@/lib/contact-link";
|
||||
|
||||
describe("normalizePhone", () => {
|
||||
it("แปลงเบอร์ไทย 0 นำหน้าเป็น +66 และตัดขีด/ช่องว่าง", () => {
|
||||
expect(normalizePhone("098-869-0997")).toBe("+66988690997");
|
||||
expect(normalizePhone("098 869 0997")).toBe("+66988690997");
|
||||
expect(normalizePhone("(02) 123-4567")).toBe("+6621234567");
|
||||
});
|
||||
|
||||
it("รองรับที่ขึ้นต้น 66 หรือ +66 อยู่แล้ว", () => {
|
||||
expect(normalizePhone("66812345678")).toBe("+66812345678");
|
||||
expect(normalizePhone("+66 81 234 5678")).toBe("+66812345678");
|
||||
});
|
||||
|
||||
it("ไม่ใช่เบอร์ → null", () => {
|
||||
expect(normalizePhone("12")).toBeNull();
|
||||
expect(normalizePhone("housesamyan")).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe("looksLikePhone", () => {
|
||||
it("แยกเบอร์ออกจากข้อความ", () => {
|
||||
expect(looksLikePhone("098-869-0997")).toBe(true);
|
||||
expect(looksLikePhone("www.housesamyan.com")).toBe(false);
|
||||
expect(looksLikePhone("House Samyan")).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("resolveContact", () => {
|
||||
it("Call + เบอร์ → tel: (กดโทรได้จริง)", () => {
|
||||
const resolved = resolveContact({
|
||||
label: "Call",
|
||||
value: "098-869-0997",
|
||||
href: null,
|
||||
});
|
||||
expect(resolved.href).toBe("tel:+66988690997");
|
||||
expect(resolved.kind).toBe("tel");
|
||||
expect(resolved.external).toBe(false);
|
||||
});
|
||||
|
||||
it("เบอร์ที่ href ผิดรูปแบบ → แก้ให้ถูก", () => {
|
||||
expect(
|
||||
contactHref({ label: "Call", value: "098-869-0997", href: "0988690997" }),
|
||||
).toBe("tel:+66988690997");
|
||||
expect(
|
||||
contactHref({
|
||||
label: "Call",
|
||||
value: "098-869-0997",
|
||||
href: "tel:0988690997",
|
||||
}),
|
||||
).toBe("tel:+66988690997");
|
||||
});
|
||||
|
||||
it("Facebook → https + ตัด fbclid/_rdc + เปลี่ยน web. เป็น www.", () => {
|
||||
const resolved = resolveContact({
|
||||
label: "Facebook",
|
||||
value: "Century Sukhumvit",
|
||||
href: "https://web.facebook.com/CenturySukhumvit/?_rdc=1&_rdr",
|
||||
});
|
||||
expect(resolved.kind).toBe("web");
|
||||
expect(resolved.external).toBe(true);
|
||||
expect(resolved.href).toBe("https://www.facebook.com/CenturySukhumvit/");
|
||||
});
|
||||
|
||||
it("เว็บที่ไม่มี scheme → เติม https", () => {
|
||||
expect(
|
||||
contactHref({
|
||||
label: "Website",
|
||||
value: "www.housesamyan.com",
|
||||
href: null,
|
||||
}),
|
||||
).toBe("https://www.housesamyan.com/");
|
||||
});
|
||||
|
||||
it("Instagram ที่ติด fbclid → ตัดออก", () => {
|
||||
const href = contactHref({
|
||||
label: "Instagram",
|
||||
value: "centurysukhumvit",
|
||||
href: "https://www.instagram.com/centurysukhumvit?fbclid=abc123",
|
||||
});
|
||||
expect(href).toBe("https://www.instagram.com/centurysukhumvit");
|
||||
});
|
||||
|
||||
it("อีเมล → mailto:", () => {
|
||||
expect(
|
||||
resolveContact({ label: "อีเมล", value: "[email protected]" }).href,
|
||||
).toBe("mailto:[email protected]");
|
||||
});
|
||||
|
||||
it("LINE ID (@id) → line.me", () => {
|
||||
expect(resolveContact({ label: "Line", value: "@alterflix" }).href).toBe(
|
||||
"https://line.me/R/ti/p/~alterflix",
|
||||
);
|
||||
});
|
||||
|
||||
it("ค่าไม่มีข้อมูล/ว่าง → null (ไม่สร้างลิงก์หลอก)", () => {
|
||||
expect(resolveContact({ label: "Call", value: "-" }).href).toBeNull();
|
||||
expect(resolveContact({ label: "Call", value: "" }).href).toBeNull();
|
||||
expect(
|
||||
resolveContact({ label: "Website", value: "ไม่มีข้อมูล" }).href,
|
||||
).toBeNull();
|
||||
});
|
||||
|
||||
it("ค่าแปลก ๆ ที่ไม่ใช่ทั้งเบอร์และโดเมน → null", () => {
|
||||
expect(
|
||||
resolveContact({ label: "Call", value: "โทรสอบถาม" }).href,
|
||||
).toBeNull();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user