fix(suggest): route sous /api ET /proxy/api + tri prefix-first style YouTube

This commit is contained in:
2026-09-26 13:56:55 -04:00
parent d9c8a2e14e
commit 4a7cb901b2
3 changed files with 24 additions and 1 deletions
+9
View File
@@ -155,6 +155,15 @@ try {
expect(JSON.stringify(withoutWeb) === JSON.stringify(['dm', 'od', 'pt', 'ru', 'tw', 'yt']), `full registry fallback (got ${keys})`);
});
await scenario('served under both /api and /proxy/api (front apiBase)', async () => {
for (const prefix of ['/api', '/proxy/api']) {
const res = await fetch(`${baseUrl}${prefix}/search/suggest?q=tutoriel&providers=yt&limit=3`);
expect(res.status === 200, `expected 200 on ${prefix}, got ${res.status}`);
const body = await res.json();
expect(body.q === 'tutoriel' && Array.isArray(body.groups?.yt), `${prefix} returns suggest JSON`);
}
});
await scenario('no duplicate occurrence across groups (web enrichment included)', async () => {
const res = await fetch(`${baseUrl}/api/search/suggest?q=tutoriel&limit=10`);
expect(res.status === 200, `expected 200, got ${res.status}`);