fix: enforce approved media publication closure
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { parsePortfolioContent, parsePublicAssetManifest, parseSiteConfig } from '@/content/schemas';
|
||||
import { validateProductionInputs } from '@/content/schemas';
|
||||
|
||||
const repositoryRoot = process.cwd();
|
||||
const readJson = async (relativePath: string): Promise<unknown> =>
|
||||
@@ -8,9 +8,12 @@ const readJson = async (relativePath: string): Promise<unknown> =>
|
||||
|
||||
describe('approved public portfolio projection', () => {
|
||||
it('contains approved identity and balanced evidence without prohibited surfaces', async () => {
|
||||
const content = parsePortfolioContent(await readJson('content/public/portfolio-content.json'));
|
||||
const manifest = parsePublicAssetManifest(await readJson('content/public/asset-manifest.json'));
|
||||
const site = parseSiteConfig(await readJson('config/site.preview.json'));
|
||||
const { content, manifest, site } = validateProductionInputs(
|
||||
await readJson('content/public/portfolio-content.json'),
|
||||
await readJson('content/public/asset-manifest.json'),
|
||||
await readJson('config/site.preview.json'),
|
||||
new URL('file:///prepared-assets/'),
|
||||
);
|
||||
|
||||
expect(content.identity).toEqual(expect.objectContaining({
|
||||
name: 'Luca Pîslaru',
|
||||
@@ -25,8 +28,6 @@ describe('approved public portfolio projection', () => {
|
||||
.toBe('Private self-hosted medication tracker');
|
||||
expect(content.projects.additional.find((project) => project.id === 'private-game-prototype')?.title)
|
||||
.toBe('Private game prototype');
|
||||
expect([...content.projects.selected, ...content.projects.additional]
|
||||
.every((project) => project.assetIds.length === 0)).toBe(true);
|
||||
expect(content.toolkit.flatMap((group) => group.technologies).map((technology) => technology.name))
|
||||
.toEqual(expect.arrayContaining(['Linux', 'Docker', 'Python', 'Vue.js', 'Java']));
|
||||
expect(content.contact).toEqual(expect.objectContaining({ email: 'luca.pislaru@gmail.com' }));
|
||||
@@ -35,7 +36,14 @@ describe('approved public portfolio projection', () => {
|
||||
'https://gitlab.com/luca_pisl',
|
||||
'https://linkedin.com/in/luca-pisl',
|
||||
]);
|
||||
expect(manifest.assets).toEqual([]);
|
||||
const publishedReferences = [
|
||||
...content.projects.selected.flatMap((project) => project.assetIds),
|
||||
...content.projects.additional.flatMap((project) => project.assetIds),
|
||||
...content.toolkit.flatMap((group) => group.technologies.flatMap((technology) =>
|
||||
technology.assetId === undefined ? [] : [technology.assetId])),
|
||||
...(content.metadata.socialPreviewAssetId === undefined ? [] : [content.metadata.socialPreviewAssetId]),
|
||||
];
|
||||
expect([...publishedReferences].sort()).toEqual(manifest.assets.map((asset) => asset.id).sort());
|
||||
expect(site).toEqual({
|
||||
environment: 'preview',
|
||||
canonicalUrl: 'https://portfolio.localhost/',
|
||||
|
||||
Reference in New Issue
Block a user