fix tests

This commit is contained in:
Giancarmine Salucci
2026-02-18 01:11:03 +01:00
parent bf3e5c679f
commit 54321fd7c9
5 changed files with 30 additions and 10 deletions

View File

@@ -234,6 +234,9 @@ export function cleanText(text: string): string {
// Remove spaces around newlines
cleaned = cleaned.replace(/ *\n */g, '\n');
// Normalize multiple spaces to single space within lines
cleaned = cleaned.replace(/ {2,}/g, ' ');
// Remove hashtags from end of text
// Pattern: #word #multiple_words (supports international characters)

View File

@@ -81,7 +81,11 @@ describe('extractFromDOM() with mocked og:description', () => {
$$: vi.fn().mockResolvedValue([]),
locator: vi.fn().mockReturnValue({
getAttribute: vi.fn().mockResolvedValue(null)
})
}),
waitForLoadState: vi.fn().mockResolvedValue(undefined),
waitForSelector: vi.fn().mockRejectedValue(new Error('No selector found')),
waitForTimeout: vi.fn().mockResolvedValue(undefined),
on: vi.fn()
} as unknown as Page;
};
@@ -153,7 +157,11 @@ describe('Integration: Full extraction flow', () => {
$$: vi.fn().mockResolvedValue([]),
locator: vi.fn().mockReturnValue({
getAttribute: vi.fn().mockResolvedValue(null)
})
}),
waitForLoadState: vi.fn().mockResolvedValue(undefined),
waitForSelector: vi.fn().mockRejectedValue(new Error('No selector found')),
waitForTimeout: vi.fn().mockResolvedValue(undefined),
on: vi.fn()
} as unknown as Page;
};