Files
landing/tests/sitemap.test.ts
T

24 lines
922 B
TypeScript

import { describe, it, expect, beforeAll } from 'vitest';
import { execSync } from 'node:child_process';
import { readFileSync, existsSync } from 'node:fs';
describe('sitemap and robots.txt', () => {
beforeAll(() => {
execSync('npm run build', { stdio: 'inherit' });
});
it('generates a sitemap index referencing both locales', () => {
expect(existsSync('dist/sitemap-index.xml')).toBe(true);
const sitemap = readFileSync('dist/sitemap-0.xml', 'utf-8');
expect(sitemap).toContain('https://www.ombrora.com/en/');
expect(sitemap).toContain('https://www.ombrora.com/fr/');
});
it('robots.txt allows all crawlers and points to the sitemap', () => {
const robots = readFileSync('dist/robots.txt', 'utf-8');
expect(robots).toContain('User-agent: *');
expect(robots).toContain('Allow: /');
expect(robots).toContain('Sitemap: https://www.ombrora.com/sitemap-index.xml');
});
});