Skip to content

Commit

Permalink
fix: use correct types for fetch mock
Browse files Browse the repository at this point in the history
Co-Authored-By: Han Xiao <[email protected]>
  • Loading branch information
devin-ai-integration[bot] and hanxiao committed Feb 13, 2025
1 parent cde7781 commit a270425
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/tools/__tests__/evaluator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jest.mock('@ai-sdk/google', () => ({
}));

// Mock fetch to prevent actual API calls
const mockFetch = jest.fn().mockResolvedValue({
const mockResponse = {
ok: true,
json: () => Promise.resolve({
choices: [{
Expand All @@ -78,9 +78,9 @@ const mockFetch = jest.fn().mockResolvedValue({
}
}]
})
});
} as Response;

global.fetch = mockFetch;
global.fetch = jest.fn().mockResolvedValue(mockResponse) as jest.Mock;

// Mock OpenAI API
jest.mock('@ai-sdk/openai', () => ({
Expand Down

0 comments on commit a270425

Please sign in to comment.