import { describe, it, expect } from 'vitest'; import { config } from '../proxy'; describe('Proxy Middleware Config Matcher', () => { const matcherRegex = new RegExp(`^${config.matcher[0]}`); it('matches localized page routes for next-intl processing', () => { expect(matcherRegex.test('/de')).toBe(true); expect(matcherRegex.test('/en/contact')).toBe(true); expect(matcherRegex.test('/karriere')).toBe(true); }); it('excludes static assets with any file extension including uppercase .JPG and subdirectories', () => { // These should NOT match the middleware (expect test to be false so middleware is bypassed) expect(matcherRegex.test('/assets/photos/DJI_0048.JPG')).toBe(false); expect(matcherRegex.test('/assets/videos/web/hero-kabelpflug-poster.jpg')).toBe(false); expect(matcherRegex.test('/assets/logo-white.png')).toBe(false); expect(matcherRegex.test('/_next/image')).toBe(false); }); });