fix: restore content compatibility checks
This commit is contained in:
@@ -36,10 +36,10 @@ const navigationLabels: Readonly<Record<(typeof sectionIds)[number], string>> =
|
||||
contact: "Contact",
|
||||
};
|
||||
|
||||
const visibleTextLeafSelector = "h1,h2,h3,p,dt,dd,li,figcaption,a,svg text";
|
||||
const visibleTextLeafSelector = "h1,h2,h3,h4,p,dt,dd,li,figcaption,a,svg text";
|
||||
const visibleTextSelector = [
|
||||
".site-header :is(h1,h2,h3,p,dt,dd,li,figcaption,a)",
|
||||
".portfolio-main :is(h1,h2,h3,p,dt,dd,li,figcaption,a)",
|
||||
".site-header :is(h1,h2,h3,h4,p,dt,dd,li,figcaption,a)",
|
||||
".portfolio-main :is(h1,h2,h3,h4,p,dt,dd,li,figcaption,a)",
|
||||
".portfolio-main svg text",
|
||||
].join(",");
|
||||
|
||||
@@ -145,8 +145,7 @@ const expectedVisibleTextSegments = (
|
||||
content.infrastructure.featuredOperation.title,
|
||||
content.infrastructure.featuredOperation.context,
|
||||
...content.infrastructure.featuredOperation.actions,
|
||||
"Outcome:",
|
||||
content.infrastructure.featuredOperation.outcome,
|
||||
`Outcome: ${content.infrastructure.featuredOperation.outcome}`,
|
||||
]),
|
||||
...section(
|
||||
"selected-builds",
|
||||
@@ -395,8 +394,8 @@ test("keeps every raw SSR reading-path segment visible without JavaScript", asyn
|
||||
}
|
||||
|
||||
const email = page.locator('a[href="mailto:luca.pislaru@gmail.com"]');
|
||||
await expect(email).toBeVisible();
|
||||
await expect(email).toHaveText("Start a conversation");
|
||||
await expect(email).toHaveCount(2);
|
||||
await expect(email).toHaveText(["Email Luca", "Email Luca"]);
|
||||
await expect(
|
||||
page.getByText(
|
||||
"For a current CV or role-specific information, contact me directly.",
|
||||
|
||||
@@ -153,8 +153,8 @@ test('keeps canonical native anchors and safe external destinations', async ({
|
||||
const email = page.locator('a[href^="mailto:"]');
|
||||
await expect(email).toHaveCount(2);
|
||||
await expect(email).toHaveText(['Email Luca', 'Email Luca']);
|
||||
expect(await email.evaluateAll((links) => new Set(links.map((link) => link.getAttribute('href'))))).toEqual(
|
||||
new Set(['mailto:luca.pislaru@gmail.com']),
|
||||
expect(await email.evaluateAll((links) => [...new Set(links.map((link) => link.getAttribute('href')))])).toEqual(
|
||||
['mailto:luca.pislaru@gmail.com'],
|
||||
);
|
||||
|
||||
const externalLinks = page.locator('#contact a[target="_blank"]');
|
||||
|
||||
@@ -67,8 +67,9 @@ describe('raw prerendered document', () => {
|
||||
expect(document.body.textContent).toContain('Secure self-hosted platform and lifecycle');
|
||||
expect(document.body.textContent).toContain('Private self-hosted medication tracker');
|
||||
expect(document.body.textContent).toContain('Linux');
|
||||
expect(document.querySelector('a[href="mailto:luca.pislaru@gmail.com"]')?.textContent)
|
||||
.toBe('Start a conversation');
|
||||
const mailLinks = document.querySelectorAll('a[href="mailto:luca.pislaru@gmail.com"]');
|
||||
expect(mailLinks).toHaveLength(2);
|
||||
expect([...mailLinks].map((link) => link.textContent)).toEqual(['Email Luca', 'Email Luca']);
|
||||
expect(document.querySelector('nav a[href="#infrastructure"]')).not.toBeNull();
|
||||
expect(snapshot).not.toBeNull();
|
||||
expect(moduleScript).not.toBeNull();
|
||||
|
||||
@@ -118,6 +118,26 @@ describe('artifact verification', () => {
|
||||
await expect(verifyArtifactDirectory(directory, inputs, contract)).resolves.toBeUndefined();
|
||||
});
|
||||
|
||||
it.each([
|
||||
{
|
||||
name: 'a missing hero mailto link',
|
||||
mutate: (html: string) => html.replace('href="mailto:luca.pislaru@gmail.com">Email Luca</a>', 'href="#selected-builds">Email Luca</a>'),
|
||||
},
|
||||
{
|
||||
name: 'a duplicate mailto link beyond the hero and contact actions',
|
||||
mutate: (html: string) => html.replace('</main>', '<a href="mailto:luca.pislaru@gmail.com">Email Luca</a></main>'),
|
||||
},
|
||||
{
|
||||
name: 'a mailto link with an address that differs from public content',
|
||||
mutate: (html: string) => html.replace('href="mailto:luca.pislaru@gmail.com">Email Luca</a>', 'href="mailto:wrong@example.test">Email Luca</a>'),
|
||||
},
|
||||
])('rejects $name', async ({ mutate }) => {
|
||||
const { directory, html, inputs, contract } = await writeValidArtifacts();
|
||||
await writeFile(join(directory, 'index.html'), mutate(html));
|
||||
|
||||
await expect(verifyArtifactDirectory(directory, inputs, contract)).rejects.toThrow(/mailto/i);
|
||||
});
|
||||
|
||||
it.each([
|
||||
{
|
||||
name: 'an omitted adaptive soundtrack file',
|
||||
|
||||
@@ -234,7 +234,10 @@ describe('useLazyMedia', () => {
|
||||
describe('media content schema', () => {
|
||||
it('requires content-owned descriptions and exact project asset closure', () => {
|
||||
const raw = JSON.parse(JSON.stringify({
|
||||
identity: { name: 'Luca Pîslaru', role: 'System Administrator & Full-Stack Developer', valueProposition: 'Value.' },
|
||||
identity: {
|
||||
name: 'Luca Pîslaru', role: 'System Administrator & Full-Stack Developer', valueProposition: 'Value.',
|
||||
location: { city: 'Bucharest', country: 'Romania', countryCode: 'RO' }, availability: 'Available remotely.',
|
||||
},
|
||||
navigation: ['start', 'profile', 'experience', 'infrastructure', 'selected-builds', 'additional-work', 'toolkit', 'contact']
|
||||
.map((id) => ({ id, label: id })),
|
||||
profile: { introduction: 'Profile.', screeningFacts: [] },
|
||||
@@ -243,6 +246,7 @@ describe('media content schema', () => {
|
||||
infrastructure: {
|
||||
id: 'infra', title: 'Secure self-hosted platform and lifecycle', summary: 'Summary.',
|
||||
bands: ['one', 'two', 'three', 'four'].map((id) => ({ id, title: id, summary: 'Summary.' })),
|
||||
featuredOperation: { title: 'Migration', context: 'Context.', actions: ['Prepare.', 'Move.', 'Validate.'], outcome: 'Completed.' },
|
||||
},
|
||||
projects: {
|
||||
selected: [
|
||||
@@ -253,7 +257,7 @@ describe('media content schema', () => {
|
||||
additional: [{ id: 'extra', title: 'Extra', visibility: 'public', maturity: 'learning', summary: 'S.', problem: 'P.', contribution: 'C.', technicalDecisions: ['D.'], outcome: 'O.', assetIds: [], media: [] }],
|
||||
},
|
||||
toolkit: [{ title: 'Tools', technologies: [{ name: 'Linux' }] }],
|
||||
contact: { email: 'hello@example.test', social: [], cvMessage: 'Contact directly.' },
|
||||
contact: { introduction: 'Open to roles.', email: 'hello@example.test', social: [], cvMessage: 'Contact directly.' },
|
||||
metadata: { title: 'Title.', description: 'Description.' },
|
||||
sceneDescription: 'Scene.',
|
||||
}));
|
||||
|
||||
@@ -2,14 +2,14 @@ import { mount } from '@vue/test-utils';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import BrandIcon from '@/components/BrandIcon.vue';
|
||||
import content from '@/../content/public/portfolio-content.json';
|
||||
import { brandIconFor, brandIconLabels } from '@/icons/brand-icons';
|
||||
import { brandIconAvailable, brandIconFor, brandIconLabels } from '@/icons/brand-icons';
|
||||
|
||||
const toolkitLabels = content.toolkit.flatMap((group) => group.technologies.map((technology) => technology.name));
|
||||
const socialLabels = content.contact.social.map((link) => link.service);
|
||||
|
||||
describe('official brand icon registry', () => {
|
||||
it('resolves every toolkit technology in validated portfolio content', () => {
|
||||
for (const label of toolkitLabels) {
|
||||
it('resolves every toolkit technology with an honest official mark', () => {
|
||||
for (const label of toolkitLabels.filter(brandIconAvailable)) {
|
||||
const icon = brandIconFor(label);
|
||||
expect(icon.title).toBeTruthy();
|
||||
expect(icon.hex).toMatch(/^[0-9A-F]{6}$/u);
|
||||
@@ -27,10 +27,13 @@ describe('official brand icon registry', () => {
|
||||
|
||||
it('keeps the registry closed over all content-facing labels', () => {
|
||||
expect(brandIconLabels).toEqual([
|
||||
'Linux', 'Docker', 'Nginx', 'Proxmox / KVM', 'Git', 'Python', 'Vue.js',
|
||||
'JavaScript', 'C# / .NET', 'Flutter / Dart', 'PostgreSQL / SQL',
|
||||
'Headless WordPress', 'Java', 'GitHub', 'GitLab', 'LinkedIn',
|
||||
'Linux', 'Docker', 'Nginx', 'cPanel', 'Authelia', 'Nextcloud', 'Proxmox/KVM',
|
||||
'Git', 'Python', 'TypeScript/JavaScript', 'Vue.js', 'Flutter/Dart', 'Fastify',
|
||||
'C#/.NET', 'Headless WordPress', 'Java', 'PostgreSQL', 'Drift/SQLite',
|
||||
'Drizzle ORM', 'PyTorch', 'Ultralytics/YOLO', 'OpenCV', 'GitHub', 'GitLab', 'LinkedIn',
|
||||
]);
|
||||
expect(['DNS', 'TLS', 'Fail2Ban', 'Btrfs', 'rsync', 'SQL', 'SPSS', 'Microsoft Excel', 'SoccerNet']
|
||||
.every((label) => !brandIconAvailable(label))).toBe(true);
|
||||
expect(() => brandIconFor('Unlisted technology')).toThrow(/No official brand icon/u);
|
||||
});
|
||||
|
||||
|
||||
@@ -163,6 +163,16 @@ describe("semantic section components", () => {
|
||||
expect(tile.findAll('[aria-label="Linux"]').length).toBe(0);
|
||||
});
|
||||
|
||||
it("renders a generic toolkit concept as visible text without inventing an icon", () => {
|
||||
const wrapper = mount(ToolkitGrid, {
|
||||
props: { groups: [{ title: "Systems", technologies: [{ name: "DNS" }] }] },
|
||||
});
|
||||
const tile = wrapper.get('[data-testid="toolkit-technology"]');
|
||||
|
||||
expect(tile.text()).toBe("DNS");
|
||||
expect(tile.find("svg").exists()).toBe(false);
|
||||
});
|
||||
|
||||
it("renders a visible mailto contact and safe verified social links", () => {
|
||||
const contact: ContactContent = {
|
||||
introduction: "Open to System Administrator and Full-Stack Developer opportunities.",
|
||||
|
||||
@@ -36,7 +36,7 @@ describe('safe metadata', () => {
|
||||
|
||||
expect(metadata.title).toBe('Luca Pîslaru — System Administrator & Full-Stack Developer');
|
||||
expect(metadata.description).toBe(
|
||||
'Portfolio of Luca Pîslaru, a System Administrator & Full-Stack Developer building and operating reliable systems and software.',
|
||||
'Portfolio of Luca Pîslaru, a Bucharest-based System Administrator and Full-Stack Developer working across Linux infrastructure and end-to-end software delivery.',
|
||||
);
|
||||
expect(metadata.canonicalUrl).toBe('https://portfolio.example.test/');
|
||||
expect(metadata.openGraph.image).toBeUndefined();
|
||||
|
||||
Reference in New Issue
Block a user