A calm place to write long-form, and publish it to the open social web.
skypress.blog/
1/**
2 * Source-level guard for the shared error scene. Page/component rendering through
3 * astro/container isn't viable in this jsdom-pinned suite (see Base.meta.test.ts),
4 * so we pin the wiring at the source level.
5 */
6import { readFileSync } from 'node:fs';
7import { dirname, join } from 'node:path';
8import { fileURLToPath } from 'node:url';
9import { describe, expect, it } from 'vitest';
10
11const here = dirname( fileURLToPath( import.meta.url ) );
12const component = readFileSync( join( here, './ErrorScene.astro' ), 'utf8' );
13
14describe( 'ErrorScene component', () => {
15 it( 'renders inside Base and opts out of social meta', () => {
16 expect( component ).toMatch( /import Base from '[^']*layouts\/Base.astro'/ );
17 expect( component ).toMatch( /socialMeta=\{false\}/ );
18 } );
19
20 it( 'marks the page noindex so playful copy is never indexed', () => {
21 expect( component ).toMatch(
22 /<meta\s+name="robots"\s+content="noindex"\s*\/?>/
23 );
24 } );
25
26 it( 'renders the eyebrow, heading and subline props', () => {
27 expect( component ).toMatch( /\{eyebrow\}/ );
28 expect( component ).toMatch( /\{heading\}/ );
29 expect( component ).toMatch( /\{subline\}/ );
30 } );
31
32 it( 'provides a single Back to homepage link to the site root', () => {
33 expect( component ).toMatch( /href="\/"[^>]*>\s*Back to homepage/ );
34 } );
35
36 it( 'disables the sun-glow animation under reduced motion', () => {
37 expect( component ).toMatch( /prefers-reduced-motion/ );
38 } );
39
40 it( 'is dependency-free (no @wordpress imports on the read path)', () => {
41 expect( component ).not.toMatch( /@wordpress\// );
42 } );
43} );