feat: add root language redirect for o2switch hosting

This commit is contained in:
2026-08-02 16:02:17 +02:00
parent f85488fe2b
commit fdd19ce874
2 changed files with 23 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
import { describe, it, expect, beforeAll } from 'vitest';
import { execSync } from 'node:child_process';
import { readFileSync } from 'node:fs';
describe('root language redirect', () => {
beforeAll(() => {
execSync('npm run build', { stdio: 'inherit' });
});
it('copies .htaccess to dist with the french/english redirect rules', () => {
const htaccess = readFileSync('dist/.htaccess', 'utf-8');
expect(htaccess).toContain('RewriteEngine On');
expect(htaccess).toContain('HTTP:Accept-Language} fr');
expect(htaccess).toContain('RewriteRule ^$ /fr/ [R=302,L]');
expect(htaccess).toContain('RewriteRule ^$ /en/ [R=302,L]');
});
});