import { runInNewContext } from 'node:vm' import { describe, expect, it } from 'vitest' import { getLocaleRedirectHTML } from '../../src/node/generate/getLocaleRedirectHTML.js' import type { RedirectBehaviorConfig } from '../../src/shared/index.js' const config = { '/': ['en-US'], '/de/': ['de-DE'], '/zh/': ['zh-CN'], } // only the non-root locales exposing the page reach the generated file const availableLocales = ['/de/', '/zh/'] const buildHTML = (options: Partial = {}): string => getLocaleRedirectHTML( { autoLocale: true, config, defaultBehavior: 'defaultLocale', defaultLocale: '/', localeFallback: true, ...options, }, availableLocales, '/', ) // the generated HTML always uses a lowercase `