firecrawl-mcp
Version:
MCP server for FireCrawl web scraping integration. Supports both cloud and self-hosted instances. Features include web scraping, batch processing, structured data extraction, and LLM-powered content analysis.
59 lines (58 loc) • 1.57 kB
JavaScript
import { jest } from '@jest/globals';
// Set test timeout
jest.setTimeout(30000);
// Create mock responses
const mockSearchResponse = {
success: true,
data: [
{
url: 'https://example.com',
title: 'Test Page',
description: 'Test Description',
markdown: '# Test Content',
actions: null,
},
],
};
const mockBatchScrapeResponse = {
success: true,
id: 'test-batch-id',
};
const mockBatchStatusResponse = {
success: true,
status: 'completed',
completed: 1,
total: 1,
creditsUsed: 1,
expiresAt: new Date(),
data: [
{
url: 'https://example.com',
title: 'Test Page',
description: 'Test Description',
markdown: '# Test Content',
actions: null,
},
],
};
// Create mock instance methods
const mockSearch = jest.fn().mockImplementation(async () => mockSearchResponse);
const mockAsyncBatchScrapeUrls = jest
.fn()
.mockImplementation(async () => mockBatchScrapeResponse);
const mockCheckBatchScrapeStatus = jest
.fn()
.mockImplementation(async () => mockBatchStatusResponse);
// Create mock instance
const mockInstance = {
apiKey: 'test-api-key',
apiUrl: 'test-api-url',
search: mockSearch,
asyncBatchScrapeUrls: mockAsyncBatchScrapeUrls,
checkBatchScrapeStatus: mockCheckBatchScrapeStatus,
};
// Mock the module
jest.mock('@mendable/firecrawl-js', () => ({
__esModule: true,
default: jest.fn().mockImplementation(() => mockInstance),
}));