import { SITE_URL, absoluteUrl } from '@/lib/site'; describe('SITE_URL', () => { it('is the www host, which is the one that serves a 200', () => { // The apex 301s to www at Cloudflare. A canonical pointing at a redirect // is a wasted signal, so every absolute URL we emit must already be www. expect(SITE_URL).toBe('https://www.schoolcompare.co.uk'); }); it('has no trailing slash, so joins never double up', () => { expect(SITE_URL.endsWith('/')).toBe(false); }); }); describe('absoluteUrl', () => { it('joins a rooted path', () => { expect(absoluteUrl('/rankings')).toBe('https://www.schoolcompare.co.uk/rankings'); }); it('joins a path missing its leading slash', () => { expect(absoluteUrl('rankings')).toBe('https://www.schoolcompare.co.uk/rankings'); }); it('maps the site root to a bare trailing slash', () => { expect(absoluteUrl('/')).toBe('https://www.schoolcompare.co.uk/'); }); });