fix: tests

This commit is contained in:
Louis 2025-08-12 10:37:00 +07:00
parent 25a0c14be8
commit 276a286853
No known key found for this signature in database
GPG Key ID: 44FA9F4D33C37DE2

View File

@ -325,7 +325,10 @@ describe('models service', () => {
expect(result).toEqual(mockRepoData) expect(result).toEqual(mockRepoData)
expect(fetch).toHaveBeenCalledWith( expect(fetch).toHaveBeenCalledWith(
'https://huggingface.co/api/models/microsoft/DialoGPT-medium?blobs=true' 'https://huggingface.co/api/models/microsoft/DialoGPT-medium?blobs=true',
{
headers: {},
}
) )
}) })
@ -341,19 +344,28 @@ describe('models service', () => {
'https://huggingface.co/microsoft/DialoGPT-medium' 'https://huggingface.co/microsoft/DialoGPT-medium'
) )
expect(fetch).toHaveBeenCalledWith( expect(fetch).toHaveBeenCalledWith(
'https://huggingface.co/api/models/microsoft/DialoGPT-medium?blobs=true' 'https://huggingface.co/api/models/microsoft/DialoGPT-medium?blobs=true',
{
headers: {},
}
) )
// Test with domain prefix // Test with domain prefix
await fetchHuggingFaceRepo('huggingface.co/microsoft/DialoGPT-medium') await fetchHuggingFaceRepo('huggingface.co/microsoft/DialoGPT-medium')
expect(fetch).toHaveBeenCalledWith( expect(fetch).toHaveBeenCalledWith(
'https://huggingface.co/api/models/microsoft/DialoGPT-medium?blobs=true' 'https://huggingface.co/api/models/microsoft/DialoGPT-medium?blobs=true',
{
headers: {},
}
) )
// Test with trailing slash // Test with trailing slash
await fetchHuggingFaceRepo('microsoft/DialoGPT-medium/') await fetchHuggingFaceRepo('microsoft/DialoGPT-medium/')
expect(fetch).toHaveBeenCalledWith( expect(fetch).toHaveBeenCalledWith(
'https://huggingface.co/api/models/microsoft/DialoGPT-medium?blobs=true' 'https://huggingface.co/api/models/microsoft/DialoGPT-medium?blobs=true',
{
headers: {},
}
) )
}) })
@ -379,7 +391,10 @@ describe('models service', () => {
expect(result).toBeNull() expect(result).toBeNull()
expect(fetch).toHaveBeenCalledWith( expect(fetch).toHaveBeenCalledWith(
'https://huggingface.co/api/models/nonexistent/model?blobs=true' 'https://huggingface.co/api/models/nonexistent/model?blobs=true',
{
headers: {},
}
) )
}) })