feat: add advisor/contact flow tables and make Blog.authorId required
Deploy Canina / deploy (push) Successful in 25m44s
Deploy Canina / deploy (push) Successful in 25m44s
This commit is contained in:
1 parent
bb81f2c944
commit
d881dc491e
86 files changed
+507
-4111
No files matched your search
@@ -80,7 +80,6 @@ describe("BlogPostClient Component", () => {
|
||||
render(
|
||||
<BlogPostClient
|
||||
blog={mockBlog}
|
||||
sanitizedContent={mockBlog.content}
|
||||
publishedDate="۱۵ فروردین ۱۴۰۵"
|
||||
authorName="دکتر توماس بکر"
|
||||
/>
|
||||
@@ -114,7 +113,6 @@ describe("BlogPostClient Component", () => {
|
||||
render(
|
||||
<BlogPostClient
|
||||
blog={mockBlog}
|
||||
sanitizedContent={mockBlog.content}
|
||||
publishedDate="۱۵ فروردین ۱۴۰۵"
|
||||
authorName="دکتر توماس بکر"
|
||||
/>
|
||||
@@ -135,7 +133,6 @@ describe("BlogPostClient Component", () => {
|
||||
render(
|
||||
<BlogPostClient
|
||||
blog={mockBlog}
|
||||
sanitizedContent={mockBlog.content}
|
||||
publishedDate="۱۵ فروردین ۱۴۰۵"
|
||||
authorName="دکتر توماس بکر"
|
||||
/>
|
||||
@@ -143,7 +140,7 @@ describe("BlogPostClient Component", () => {
|
||||
|
||||
// Related Products
|
||||
expect(screen.getByText("مکملهای مرتبط این مقاله")).toBeInTheDocument();
|
||||
expect(screen.getAllByText("قرص کانیهیدروکس GAG").length).toBeGreaterThan(0);
|
||||
expect(screen.getByText("قرص کانیهیدروکس GAG")).toBeInTheDocument();
|
||||
expect(screen.getByText(/۱٬۸۵۰٬۰۰۰ تومان/)).toBeInTheDocument();
|
||||
|
||||
// Related Blogs
|
||||
@@ -173,7 +170,6 @@ describe("BlogPostClient Component", () => {
|
||||
render(
|
||||
<BlogPostClient
|
||||
blog={mockBlog}
|
||||
sanitizedContent={mockBlog.content}
|
||||
publishedDate="۱۵ فروردین ۱۴۰۵"
|
||||
authorName="دکتر توماس بکر"
|
||||
/>
|
||||
@@ -219,7 +215,6 @@ describe("BlogPostClient Component", () => {
|
||||
render(
|
||||
<BlogPostClient
|
||||
blog={mockBlog}
|
||||
sanitizedContent={mockBlog.content}
|
||||
publishedDate="۱۵ فروردین ۱۴۰۵"
|
||||
authorName="دکتر توماس بکر"
|
||||
/>
|
||||
@@ -246,7 +241,6 @@ describe("BlogPostClient Component", () => {
|
||||
render(
|
||||
<BlogPostClient
|
||||
blog={mockBlog}
|
||||
sanitizedContent={mockBlog.content}
|
||||
publishedDate="۱۵ فروردین ۱۴۰۵"
|
||||
authorName="دکتر توماس بکر"
|
||||
/>
|
||||
@@ -260,43 +254,4 @@ describe("BlogPostClient Component", () => {
|
||||
expect(screen.getByText("لینک کپی شد!")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
it("renders the server-sanitized article HTML instead of recomputing content in the browser", () => {
|
||||
const rawContent = "<!--metaTitle: hidden--><p>متن خام متفاوت</p><script>alert(1)</script>";
|
||||
const sanitizedContent = "<p>اگر بچهگربهای یتیم پیدا کردهاید</p><h2>راهنمای تغذیه</h2>";
|
||||
|
||||
const { container } = render(
|
||||
<BlogPostClient
|
||||
blog={{ ...mockBlog, content: rawContent }}
|
||||
sanitizedContent={sanitizedContent}
|
||||
publishedDate="۱۵ فروردین ۱۴۰۵"
|
||||
authorName="دکتر توماس بکر"
|
||||
/>
|
||||
);
|
||||
|
||||
const article = container.querySelector('.article-html-content');
|
||||
expect(article?.innerHTML).toBe(sanitizedContent);
|
||||
expect(article).toHaveTextContent('اگر بچهگربهای یتیم پیدا کردهاید');
|
||||
expect(article?.innerHTML).not.toContain('metaTitle');
|
||||
expect(article?.innerHTML).not.toContain('<script');
|
||||
});
|
||||
|
||||
|
||||
it("renders in-article product cards when content has product markers", () => {
|
||||
const contentWithMarker = `<p>توضیحات مهم درباره آرتروز سگها:</p><p>[product canhydrox-gag-tablets]</p><p>توضیحات تکمیلی</p>`;
|
||||
|
||||
render(
|
||||
<BlogPostClient
|
||||
blog={mockBlog}
|
||||
sanitizedContent={contentWithMarker}
|
||||
publishedDate="۱۵ فروردین ۱۴۰۵"
|
||||
authorName="دکتر توماس بکر"
|
||||
/>
|
||||
);
|
||||
|
||||
expect(screen.getByTestId("article-product-card")).toBeInTheDocument();
|
||||
expect(screen.getAllByText("قرص کانیهیدروکس GAG").length).toBeGreaterThan(0);
|
||||
expect(screen.getByText("ضمانت ۱۰۰٪ اصالت آلمان")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
});
|
||||
Reference in new issue
Block a user