content: integrate approved project evidence

This commit is contained in:
2026-09-04 23:57:29 +03:00
parent 4735ceffe5
commit 2fce0cedee
15 changed files with 564 additions and 25 deletions

View File

@@ -81,14 +81,17 @@ describe('raw prerendered document', () => {
expect(readProductionInputsSnapshot(document)).toEqual(inputs);
});
it('emits one canonical, one safe ProfilePage, and no fabricated preview image', async () => {
const { html } = await renderRawArtifact();
it('emits one canonical, one safe ProfilePage, and the approved preview image', async () => {
const { html, inputs } = await renderRawArtifact();
const document = new DOMParser().parseFromString(html, 'text/html');
const jsonLdNodes = document.querySelectorAll('script[type="application/ld+json"]');
const previewAsset = inputs.manifest.assets.find(({ id }) => id === inputs.content.metadata.socialPreviewAssetId)!;
expect(document.querySelectorAll('link[rel="canonical"]')).toHaveLength(1);
expect(document.querySelector('link[rel="canonical"]')?.getAttribute('href')).toBe('https://portfolio.localhost/');
expect(document.querySelectorAll('meta[property="og:image"]')).toHaveLength(0);
expect(document.querySelectorAll('meta[property="og:image"]')).toHaveLength(1);
expect(document.querySelector('meta[property="og:image"]')?.getAttribute('content'))
.toBe(`https://portfolio.localhost/assets/${previewAsset.fileName}`);
expect(jsonLdNodes).toHaveLength(1);
const jsonLd = JSON.parse(jsonLdNodes[0]!.textContent ?? '');
expect(jsonLd['@type']).toBe('ProfilePage');