@@ -192,51 +192,49 @@ describe('LinkupClient', () => {
192192 } ) ;
193193
194194 describe ( 'fetch method' , ( ) => {
195- it ( 'should make a successful fetch API call with HTML output ' , async ( ) => {
196- const mockResponse = { data : '<html><body> Content</body></html>' } ;
195+ it ( 'should make a successful fetch API call' , async ( ) => {
196+ const mockResponse = { data : { content : ' Content' } } ;
197197 mockAxiosInstance . post . mockResolvedValueOnce ( mockResponse as AxiosResponse ) ;
198198
199199 const result = await underTest . fetch ( {
200- outputFormat : 'html' ,
201200 url : 'https://example.com' ,
202201 } ) ;
203202
204203 expect ( mockAxiosInstance . post ) . toHaveBeenCalledWith ( '/fetch' , {
205- outputFormat : 'html' ,
206204 url : 'https://example.com' ,
207205 } ) ;
208- expect ( result ) . toEqual ( '<html><body> Content</body></html>' ) ;
206+ expect ( result ) . toEqual ( { content : ' Content' } ) ;
209207 } ) ;
210208
211- it ( 'should make a successful fetch API call with Markdown output' , async ( ) => {
212- const mockResponse = { data : '# Title\n\nContent' } ;
209+ it ( 'should make a successful fetch API call including raw HTML' , async ( ) => {
210+ const mockResponse = {
211+ data : { content : 'Content' , rawHtml : '<h1>Title</h1><p>Content</p>' } ,
212+ } ;
213213 mockAxiosInstance . post . mockResolvedValueOnce ( mockResponse as AxiosResponse ) ;
214214
215215 const result = await underTest . fetch ( {
216- outputFormat : 'markdown' ,
216+ includeRawHtml : true ,
217217 url : 'https://example.com' ,
218218 } ) ;
219219
220220 expect ( mockAxiosInstance . post ) . toHaveBeenCalledWith ( '/fetch' , {
221- outputFormat : 'markdown' ,
221+ includeRawHtml : true ,
222222 url : 'https://example.com' ,
223223 } ) ;
224- expect ( result ) . toEqual ( '# Title\n\nContent' ) ;
224+ expect ( result ) . toEqual ( { content : 'Content' , rawHtml : '<h1> Title</h1><p>Content</p>' } ) ;
225225 } ) ;
226226
227227 it ( 'should handle fetch with renderJS parameter' , async ( ) => {
228- const mockResponse = { data : 'Fetched content' } ;
228+ const mockResponse = { data : { content : 'Fetched content' } } ;
229229 mockAxiosInstance . post . mockResolvedValueOnce ( mockResponse as AxiosResponse ) ;
230230
231231 await underTest . fetch ( {
232- outputFormat : 'html' ,
233- renderJS : true ,
232+ renderJs : true ,
234233 url : 'https://example.com' ,
235234 } ) ;
236235
237236 expect ( mockAxiosInstance . post ) . toHaveBeenCalledWith ( '/fetch' , {
238- outputFormat : 'html' ,
239- renderJS : true ,
237+ renderJs : true ,
240238 url : 'https://example.com' ,
241239 } ) ;
242240 } ) ;
@@ -254,7 +252,6 @@ describe('LinkupClient', () => {
254252
255253 try {
256254 await underTest . fetch ( {
257- outputFormat : 'html' ,
258255 url : 'https://invalid-url.com' ,
259256 } ) ;
260257 fail ( 'Expected fetch to throw an error' ) ;
0 commit comments