feat(generation): score articles with selected relevance model (#48)
This commit is contained in:
@ -8,8 +8,8 @@ afterEach(() => {
|
||||
|
||||
it('charge et sauvegarde les préférences du compte via GET et PUT /api/me/preferences', async () => {
|
||||
localStorage.setItem('token', 'user-token')
|
||||
const initial = { language: 'fr', ranking_mode: 'title', summary_prompt_token_budget: 250000 }
|
||||
const updated = { language: 'en' as const, ranking_mode: 'title_content' as const, summary_prompt_token_budget: 80000 }
|
||||
const initial = { language: 'fr', ranking_mode: 'title', summary_prompt_token_budget: 250000, ranking_model_id: null }
|
||||
const updated = { language: 'en' as const, ranking_mode: 'title_content' as const, summary_prompt_token_budget: 80000, ranking_model_id: 'ranking-model' }
|
||||
const fetchMock = vi.fn()
|
||||
.mockResolvedValueOnce(new Response(JSON.stringify({ data: initial }), { status: 200 }))
|
||||
.mockResolvedValueOnce(new Response(JSON.stringify({ data: updated }), { status: 200 }))
|
||||
@ -22,3 +22,13 @@ it('charge et sauvegarde les préférences du compte via GET et PUT /api/me/pref
|
||||
method: 'PUT', headers, body: JSON.stringify(updated),
|
||||
})
|
||||
})
|
||||
|
||||
it('charge le catalogue ranking via son rôle sans changer le catalogue synthèse', async () => {
|
||||
const fetchMock = vi.fn().mockImplementation(async () => new Response(JSON.stringify({ data: [] }), { status: 200 }))
|
||||
vi.stubGlobal('fetch', fetchMock)
|
||||
const ranking = (preferencesApi as unknown as { listRankingModels: () => Promise<unknown> }).listRankingModels
|
||||
expect(ranking).toBeTypeOf('function')
|
||||
await ranking()
|
||||
await preferencesApi.listSummaryModels()
|
||||
expect(fetchMock.mock.calls.map(call => call[0])).toEqual(['/api/me/summary-models?role=ranking', '/api/me/summary-models'])
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user