mirror of
https://github.com/hanzo-docs/docs.git
synced 2026-10-25 04:20:02 +00:00
Core: Fix static export map
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'fumadocs-core': patch
|
||||
---
|
||||
|
||||
Fix static export map
|
||||
@@ -129,7 +129,7 @@ export function createI18nSearchAPI<T extends 'simple' | 'advanced'>(
|
||||
return createEndpoint({
|
||||
async export() {
|
||||
const map = await get;
|
||||
const entries = Object.entries(map).map(async ([k, v]) => [
|
||||
const entries = Array.from(map.entries()).map(async ([k, v]) => [
|
||||
k,
|
||||
await (v as SearchServer).export(),
|
||||
]);
|
||||
|
||||
@@ -97,4 +97,14 @@ test('Search API I18n', async () => {
|
||||
expect(await api.search('English', { locale: 'en' })).toHaveLength(1);
|
||||
expect(await api.search('amico', { locale: 'italian' })).toHaveLength(1);
|
||||
expect(await api.search('italian', { locale: 'en' })).toHaveLength(0);
|
||||
const exported = await api.export();
|
||||
expect(exported.type).toBe('i18n');
|
||||
|
||||
if (exported.type === 'i18n')
|
||||
expect(Object.keys(exported.data)).toMatchInlineSnapshot(`
|
||||
[
|
||||
"italian",
|
||||
"en",
|
||||
]
|
||||
`);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user