x
This commit is contained in:
1 parent
e509e3f0a2
commit
0d4df55d93
7 files changed
+526
-3
No files matched your search
@@ -17,7 +17,12 @@ const websiteBlockTypes = [
|
||||
"BANNER",
|
||||
"HERO_ARTICLE",
|
||||
"RICH_TEXT",
|
||||
"ARTICLE_HEADER",
|
||||
"ARTICLE_MEDIA",
|
||||
"ARTICLE_GALLERY",
|
||||
"ARTICLE_FACTS",
|
||||
"ARTICLE_VIDEO",
|
||||
"ARTICLE_REFERENCES",
|
||||
"SCENT_NOTES_BREAKDOWN",
|
||||
"QUOTE_CALLOUT",
|
||||
"PRODUCT_CAROUSEL",
|
||||
@@ -82,6 +87,24 @@ describe("Page Builder block contracts", () => {
|
||||
});
|
||||
});
|
||||
|
||||
test("ARTICLE_GALLERY rejects fewer than two images", () => {
|
||||
const result = validatePayloadAgainstMetadata("ARTICLE_GALLERY", {
|
||||
images: [{ imageUrl: "/uploads/one.jpg", alt: { th: "ภาพเดียว" } }],
|
||||
});
|
||||
|
||||
expect(result.valid).toBe(false);
|
||||
expect(result.validationIssues.some((issue) => issue.path === "images")).toBe(true);
|
||||
});
|
||||
|
||||
test("ARTICLE_VIDEO rejects non-HTTPS URLs", () => {
|
||||
const result = validatePayloadAgainstMetadata("ARTICLE_VIDEO", {
|
||||
videoUrl: "http://example.com/video.mp4",
|
||||
});
|
||||
|
||||
expect(result.valid).toBe(false);
|
||||
expect(result.validationIssues.some((issue) => issue.path === "videoUrl")).toBe(true);
|
||||
});
|
||||
|
||||
test("create_page_with_section rejects invalid payloads without calling backend", async () => {
|
||||
let postCalls = 0;
|
||||
const api = {
|
||||
|
||||
Reference in new issue
Block a user