/ src / tests / __mocks__ / html-to-pdfmake.ts
html-to-pdfmake.ts
 1  /**
 2   * Mock for html-to-pdfmake module
 3   *
 4   * This mock converts HTML to pdfmake document definition format.
 5   */
 6  
 7  export default function htmlToPdfmake(htmlContent: string, options?: any): any {
 8    // Simple mock conversion that extracts basic text
 9    const text = htmlContent
10      .replace(/<[^>]*>/g, " ") // Remove HTML tags
11      .replace(/\s+/g, " ") // Normalize whitespace
12      .trim();
13  
14    // Return a simple pdfmake document definition
15    return [
16      {
17        text: text || "Empty document",
18        fontSize: 12,
19        margin: [0, 5, 0, 10],
20      },
21    ];
22  }