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,70 +0,0 @@
|
||||
/**
|
||||
* ทดสอบ sitemap.xml — กันกรณี "crawler เปิดได้แต่ได้ไฟล์ผิด"
|
||||
* (ไม่มีโรงที่ hidden, URL เป็นโดเมน production, XML ถูกต้อง)
|
||||
*/
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import type { Cinema } from "@/lib/cinemas";
|
||||
import { SITE } from "@/lib/site";
|
||||
|
||||
/** origin ปลอมสำหรับทดสอบ (โค้ดจริงหาจาก request) */
|
||||
const ORIGIN = "https://example.test";
|
||||
import { buildSitemapXml, sitemapLocation } from "@/lib/sitemap";
|
||||
|
||||
function cinema(slug: string, hidden = false): Cinema {
|
||||
return {
|
||||
slug,
|
||||
name: slug,
|
||||
tags: [],
|
||||
location_label: "",
|
||||
coordinates: null,
|
||||
description: "",
|
||||
map_url: null,
|
||||
address_lines: [],
|
||||
transport: [],
|
||||
contacts: [],
|
||||
payments: [],
|
||||
photos: [],
|
||||
...(hidden ? { hidden: true } : {}),
|
||||
} as Cinema;
|
||||
}
|
||||
|
||||
describe("sitemapLocation", () => {
|
||||
it("หน้าแรกต้องมี / ปิดท้าย", () => {
|
||||
expect(sitemapLocation(ORIGIN, "/")).toBe(`${ORIGIN}/`);
|
||||
});
|
||||
|
||||
it("พาธอื่นต่อท้ายโดเมนตรง ๆ", () => {
|
||||
expect(sitemapLocation(ORIGIN, "/about")).toBe(`${ORIGIN}/about`);
|
||||
expect(sitemapLocation(ORIGIN, "about")).toBe(`${ORIGIN}/about`);
|
||||
});
|
||||
});
|
||||
|
||||
describe("buildSitemapXml", () => {
|
||||
it("มีหน้า static ครบตาม SITE.staticPages", () => {
|
||||
const xml = buildSitemapXml(ORIGIN, []);
|
||||
for (const page of SITE.staticPages) {
|
||||
expect(xml).toContain(`<loc>${sitemapLocation(ORIGIN, page.path)}</loc>`);
|
||||
}
|
||||
expect(xml.startsWith('<?xml version="1.0" encoding="UTF-8"?>')).toBe(true);
|
||||
expect(xml).toContain("</urlset>");
|
||||
});
|
||||
|
||||
it("เพิ่มหน้าโรงหนัง และข้ามโรงที่ hidden", () => {
|
||||
const xml = buildSitemapXml(ORIGIN, [
|
||||
cinema("visible-cinema"),
|
||||
cinema("secret", true),
|
||||
]);
|
||||
expect(xml).toContain(`${ORIGIN}/cinema/visible-cinema`);
|
||||
expect(xml).not.toContain("secret");
|
||||
});
|
||||
|
||||
it("ไม่ปล่อย localhost ลงใน sitemap", () => {
|
||||
expect(buildSitemapXml(ORIGIN, [cinema("x")])).not.toContain("localhost");
|
||||
});
|
||||
|
||||
it("escape อักขระ XML ใน slug", () => {
|
||||
const xml = buildSitemapXml(ORIGIN, [cinema("a&b")]);
|
||||
expect(xml).toContain("a&b");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user