This commit is contained in:
20
src/lib/title.test.ts
Normal file
20
src/lib/title.test.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
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();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user