import { describe, expect, it } from 'vitest'; import { formatTitle, getTitle, siteEnvironment } from './title'; describe('site titles', () => { it('uses one suffix and an environment prefix', () => { expect(getTitle('/', 'DEV')).toBe('(DEV) Home | Stan Runge'); expect(getTitle('/projects/catch-em-all', 'STAGING')).toBe('(STAGING) Catchemall | Stan Runge'); expect(formatTitle('A blog post')).toBe('A blog post | Stan Runge'); }); it('gives unlisted routes a readable title', () => { expect(getTitle('/projects/typing-practice')).toBe('typing practice | Stan Runge'); }); it('labels development and staging without labelling production', () => { expect(siteEnvironment(true, 'https://staging.stanrunge.dev')).toBe('DEV'); expect(siteEnvironment(false, 'https://staging.stanrunge.dev')).toBe('STAGING'); expect(siteEnvironment(false, 'https://stanrunge.dev')).toBeNull(); }); });