import { readFile } from 'node:fs/promises'; import { describe, expect, it } from 'vitest'; import { parsePortfolioContent, parsePublicAssetManifest, parseSiteConfig } from '@/content/schemas'; const repositoryRoot = process.cwd(); const readJson = async (relativePath: string): Promise => JSON.parse(await readFile(`${repositoryRoot}/${relativePath}`, 'utf8')) as 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')); expect(content.identity).toEqual(expect.objectContaining({ name: 'Luca Pîslaru', role: 'System Administrator & Full-Stack Developer', })); expect(content.systemsOperations.title).toBe('Professional systems operations'); expect(content.infrastructure.title).toBe('Secure self-hosted platform and lifecycle'); expect(content.projects.selected).toHaveLength(3); expect(content.projects.selected.filter((project) => project.visibility === 'private') .every((project) => project.url === undefined)).toBe(true); expect(content.projects.selected.find((project) => project.visibility === 'private')?.title) .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' })); expect(content.contact.social.map((link) => link.url)).toEqual([ 'https://github.com/LucaPisl', 'https://gitlab.com/luca_pisl', 'https://linkedin.com/in/luca-pisl', ]); expect(manifest.assets).toEqual([]); expect(site).toEqual({ environment: 'preview', canonicalUrl: 'https://portfolio.localhost/', buildId: 'preview-semantic-v1', }); expect(JSON.stringify(content)).not.toMatch(/Arch Linux|CV download|heatmap|expert|percent/i); }); });