feat: add root language redirect for o2switch hosting
This commit is contained in:
@@ -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]');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user