fix(cms): honor explicit null author without defaulting to publisher

This commit is contained in:
Hermes Agent committed 2026-10-24 23:04:40 +00:00
1 parent e96a13b255
commit bf3334878a
3 files changed
+51 -6

No files matched your search

@@ -87,9 +87,9 @@ describe('BlogPostPage FAQPage Schema injection (SEO-P1-07)', () => {
const jsx=await BlogPostPage({params:Promise.resolve({slug:'technical'})}); const script:any=React.Children.toArray(jsx.props.children)[0]; const json=JSON.parse(script.props.dangerouslySetInnerHTML.__html); expect(json.dateModified).toBeUndefined();
});
it('uses the stable Organization fallback visibly and in metadata', async () => {
it.each([null, { firstName: '', lastName: '' }])('uses the stable Organization fallback for author %j visibly and in metadata', async (author) => {
vi.stubGlobal('fetch', vi.fn().mockResolvedValue({ ok: true, json: async () => ({
slug: 'authorless', title: 'Authorless', content: '<p>x</p>', publishedAt: '2026-01-01T00:00:00Z', author: { firstName: '', lastName: '' },
slug: 'authorless', title: 'Authorless', content: '<p>x</p>', publishedAt: '2026-01-01T00:00:00Z', author, authorTeam: null,
}) }));
const metadata = await generateMetadata({ params: Promise.resolve({ slug: 'authorless' }) });
@@ -106,7 +106,7 @@ describe('BlogPostPage FAQPage Schema injection (SEO-P1-07)', () => {
});
});
it('uses a custom authorTeam as the authorless Organization identity in metadata and rendering', async () => {
it('keeps custom team attribution separate from the Organization author identity', async () => {
const organizationName = 'تیم دامپزشکی کنینا';
vi.stubGlobal('fetch', vi.fn().mockResolvedValue({ ok: true, json: async () => ({
slug: 'custom-team',