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.2 kB View raw
1import { describe, it, expect } from 'vitest'; 2import { readFileSync } from 'node:fs'; 3import { dirname, join } from 'node:path'; 4import { fileURLToPath } from 'node:url'; 5 6// Read the page source off disk. We resolve via `fileURLToPath` + `join` rather 7// than handing a `URL` straight to `readFileSync` because, under this repo's 8// Astro/Vite-backed Vitest, the global `URL` resolves a relative specifier 9// against the test module to an `http://localhost` dev-server URL (not `file:`), 10// which `readFileSync` rejects. This mirrors the sibling `_*.meta.test.ts` pages. 11const here = dirname( fileURLToPath( import.meta.url ) ); 12const src = readFileSync( join( here, './write.astro' ), 'utf8' ); 13 14describe( '/write route', () => { 15 it( 'mounts WriteStudio as a client:only island', () => { 16 expect( src ).toContain( "import WriteStudio from '../components/WriteStudio.tsx'" ); 17 expect( src ).toMatch( /<WriteStudio\s+client:only="react"/ ); 18 } ); 19 20 it( 'ships a writing-focused title and the write chrome styles', () => { 21 expect( src ).toMatch( /<Base title="Write[^"]*"/ ); 22 expect( src ).toContain( "import '../styles/write-chrome.css'" ); 23 } ); 24} );