fix(blog): expose author role and bound FAQ heading extraction
Deploy Canina / deploy (push) Successful in 10m28s
Deploy Canina / deploy (push) Successful in 10m28s
This commit is contained in:
1 parent
0ab2980ff4
commit
13dceaa460
4 files changed
+32
-3
No files matched your search
@@ -214,6 +214,11 @@ export default function BlogPostClient({ blog, publishedDate, authorName, author
|
||||
<div className="font-bold text-xs text-medical-gray-400 mt-0.5">
|
||||
تیم: {authorTeam || blog.authorTeam || BLOG_TEAM_FALLBACK}
|
||||
</div>
|
||||
{typeof blog.authorRole === 'string' && blog.authorRole.trim() && (
|
||||
<div className="font-bold text-xs text-medical-gray-500 mt-1">
|
||||
نقش نویسنده: {blog.authorRole.trim()}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
|
||||
@@ -119,6 +119,14 @@ describe("BlogPostClient Component", () => {
|
||||
expect(document.querySelectorAll("time[datetime]").length).toBe(2);
|
||||
});
|
||||
|
||||
it("displays an explicit author role without inventing one for older articles", () => {
|
||||
const props = { sanitizedContent: mockBlog.content, publishedDate: "۱۴۰۵/۸/۳", authorName: "کارشناس کنینا" };
|
||||
const { rerender } = render(<BlogPostClient {...props} blog={{ ...mockBlog, authorRole: "پژوهش مراقبت گوش و نگهداری ایمن" }} />);
|
||||
expect(screen.getByText("نقش نویسنده: پژوهش مراقبت گوش و نگهداری ایمن")).toBeInTheDocument();
|
||||
rerender(<BlogPostClient {...props} blog={{ ...mockBlog, authorRole: " " }} />);
|
||||
expect(screen.queryByText(/نقش نویسنده:/)).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("registers blog view count on mount via API", async () => {
|
||||
render(
|
||||
<BlogPostClient
|
||||
|
||||
Reference in new issue
Block a user