Jelajahi Sumber

fixes type in test

Mish Ushakov 2 bulan lalu
induk
melakukan
d4221e462c
3 mengubah file dengan 4 tambahan dan 4 penghapusan
  1. 1 1
      src/index.ts
  2. 2 2
      src/preprocess.ts
  3. 1 1
      tests/streaming.test.ts

+ 1 - 1
src/index.ts

@@ -57,7 +57,7 @@ export default class LLMScraper {
     options?: ScraperLLMOptions
   ) {
     const preprocessed = await preprocess(page, {
-      format: 'raw',
+      format: 'raw_html',
       ...options,
     })
     return generateAISDKCode<T>(this.client, preprocessed, schema, options)

+ 2 - 2
src/preprocess.ts

@@ -5,7 +5,7 @@ import cleanup from './cleanup.js'
 
 export type PreProcessOptions =
   | {
-      format?: 'html' | 'text' | 'markdown' | 'raw'
+      format?: 'html' | 'text' | 'markdown' | 'raw_html'
     }
   | {
       format: 'custom'
@@ -29,7 +29,7 @@ export async function preprocess(
   const url = page.url()
   let content
 
-  if (options.format === 'raw') {
+  if (options.format === 'raw_html') {
     content = await page.content()
   }
 

+ 1 - 1
tests/streaming.test.ts

@@ -20,7 +20,7 @@ test('streaming', async ({ page, scraper }) => {
 
   let last: Partial<z.infer<typeof schema>>[] = []
   for await (const item of stream) {
-    last = item
+    last = item as typeof last
   }
 
   expect(last).toHaveLength(5)