Files
my-protfolio/tests/footer-scene.test.mjs

33 lines
1.4 KiB
JavaScript

import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import test from 'node:test';
test('the isometric footer uses editable contact destinations and email', async () => {
const footer = await readFile('src/components/IsometricFooter/IsometricFooter.tsx', 'utf8');
assert.match(footer, /portfolio\.profile\.contacts/);
assert.match(footer, /portfolio\.profile\.email/);
assert.doesNotMatch(footer, /amiirkhl|09388263077/);
});
test('the footer renders the IsometricFooter scene instead of preloading PNG artwork', async () => {
const footerSection = await readFile('src/components/FooterSection.tsx', 'utf8');
assert.match(footerSection, /<IsometricFooter portfolio=\{portfolio\}\s*\/>/);
assert.doesNotMatch(footerSection, /next\/image/);
assert.doesNotMatch(footerSection, /footer-background.*\.png/);
});
test('the footer and large SVG stay server-rendered with delegated interaction', async () => {
const [footer, scene, interaction] = await Promise.all([
readFile('src/components/IsometricFooter/IsometricFooter.tsx', 'utf8'),
readFile('src/components/IsometricFooter/IsometricScene.tsx', 'utf8'),
readFile('src/components/IsometricFooter/FooterInteraction.tsx', 'utf8'),
]);
assert.doesNotMatch(footer, /^['"]use client['"]/);
assert.doesNotMatch(scene, /^['"]use client['"]/);
assert.match(interaction, /^['"]use client['"]/);
assert.match(footer, /data-contact-id=/);
});