Files
personal-website/src/lib/title.test.ts
Stan Runge d0c7b6548b
Some checks failed
Test and deploy staging / staging (push) Has been cancelled
beeeeg update
2026-09-23 04:16:50 +00:00

21 lines
904 B
TypeScript

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();
});
});