From 276a286853cf2ff7202b95172328a2bc681b1149 Mon Sep 17 00:00:00 2001 From: Louis Date: Tue, 12 Aug 2025 10:37:00 +0700 Subject: [PATCH] fix: tests --- web-app/src/services/__tests__/models.test.ts | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/web-app/src/services/__tests__/models.test.ts b/web-app/src/services/__tests__/models.test.ts index b648b2677..b783f6ab5 100644 --- a/web-app/src/services/__tests__/models.test.ts +++ b/web-app/src/services/__tests__/models.test.ts @@ -325,7 +325,10 @@ describe('models service', () => { expect(result).toEqual(mockRepoData) 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' ) 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 await fetchHuggingFaceRepo('huggingface.co/microsoft/DialoGPT-medium') 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 await fetchHuggingFaceRepo('microsoft/DialoGPT-medium/') 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(fetch).toHaveBeenCalledWith( - 'https://huggingface.co/api/models/nonexistent/model?blobs=true' + 'https://huggingface.co/api/models/nonexistent/model?blobs=true', + { + headers: {}, + } ) })