A calm place to write long-form, and publish it to the open social web. skypress.blog/
0

Configure Feed

Select the types of activity you want to include in your feed.

at trunk 1.6 kB View raw
1/** 2 * The home page leads with the writing-first experience (/write), not the gated editor. 3 * 4 * Source-level asserts (like the sibling _index.*.test.ts) — rendering the page through 5 * astro/container isn't viable under the jsdom-pinned runner, so we pin the link targets 6 * at the source. 7 */ 8import { readFileSync } from 'node:fs'; 9import { dirname, join } from 'node:path'; 10import { fileURLToPath } from 'node:url'; 11import { describe, expect, it } from 'vitest'; 12 13// Resolve via `fileURLToPath` + `join` (not `new URL(rel, import.meta.url)`): under this 14// repo's Astro/Vite-backed Vitest the global `URL` resolves a relative specifier to an 15// `http://localhost` dev URL, which `readFileSync` rejects. Mirrors `_write.meta.test.ts`. 16const here = dirname( fileURLToPath( import.meta.url ) ); 17const src = readFileSync( join( here, './index.astro' ), 'utf8' ); 18 19describe( 'home page leads with the writing-first experience', () => { 20 it( 'points the masthead Write button at /write, not the gated editor', () => { 21 expect( src ).toMatch( /class="[^"]*masthead-write[^"]*"\s+href="\/write"/ ); 22 // The home page no longer routes anyone to the login-gated /editor. 23 expect( src ).not.toContain( 'href="/editor"' ); 24 } ); 25 26 it( 'gives the hero a primary "Start writing" CTA to /write', () => { 27 expect( src ).toMatch( /href="\/write"[^>]*>\s*Start writing/ ); 28 } ); 29 30 it( 'offers no sign-in island on the home page — signing in happens via Publish on /write', () => { 31 expect( src ).not.toContain( '<HandleStart' ); 32 expect( src ).not.toMatch( /import HandleStart/ ); 33 } ); 34} );