18 lines
1.8 KiB
TypeScript
18 lines
1.8 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
|
|
// @ts-expect-error The production smoke checker is an executable ESM module.
|
|
import { verifyNoJavaScriptDocument } from '../../scripts/smoke-production.mjs';
|
|
|
|
describe('JavaScript-disabled production document', () => {
|
|
it('requires substantive semantic identity, work evidence, navigation, and contact content', () => {
|
|
const html = '<!doctype html><html><head><title>Luca Pîslaru</title></head><body><nav><a href="#selected-builds">Selected builds</a><a href="#contact">Contact</a></nav><main><h1>Luca Pîslaru</h1><p>System Administrator & Full-Stack Developer</p><section id="selected-builds"><h2>Selected builds</h2><p>Project evidence and technical decisions.</p></section><section id="contact"><h2>Contact</h2><a href="mailto:portfolio@example.test">Email Luca</a></section></main><script src="/assets/app.12345678.js"></script></body></html>';
|
|
expect(verifyNoJavaScriptDocument(html)).toMatchObject({ headings: expect.any(Number), links: expect.any(Number) });
|
|
});
|
|
|
|
it('rejects a JavaScript-only shell, source maps, and private identifiers', () => {
|
|
expect(() => verifyNoJavaScriptDocument('<div id="app"></div><script src="app.js"></script>')).toThrow(/substantive|identity/u);
|
|
expect(() => verifyNoJavaScriptDocument('<main><h1>Luca Pîslaru</h1><p>System Administrator & Full-Stack Developer</p><h2>Selected builds</h2><p>Evidence</p><h2>Contact</h2><a href="mailto:x@y.z">Email</a><script src="app.js.map"></script></main>')).toThrow(/source map/u);
|
|
expect(() => verifyNoJavaScriptDocument('<main><h1>Luca Pîslaru</h1><p>System Administrator & Full-Stack Developer</p><h2>Selected builds</h2><p>SimpaSteel is private.</p><h2>Contact</h2><a href="mailto:x@y.z">Email</a></main>')).toThrow(/private identifier/u);
|
|
});
|
|
});
|