@@ -41,7 +41,7 @@ describe("parseMentions - URL error handling", () => {
4141
4242 expect ( consoleErrorSpy ) . toHaveBeenCalledWith ( "Error fetching URL https://example.com:" , timeoutError )
4343 expect ( vscode . window . showErrorMessage ) . toHaveBeenCalledWith ( "common:errors.url_fetch_error_with_url" )
44- expect ( result ) . toContain ( "Error fetching content: Navigation timeout of 30000 ms exceeded" )
44+ expect ( result . text ) . toContain ( "Error fetching content: Navigation timeout of 30000 ms exceeded" )
4545 } )
4646
4747 it ( "should handle DNS resolution errors" , async ( ) => {
@@ -51,7 +51,7 @@ describe("parseMentions - URL error handling", () => {
5151 const result = await parseMentions ( "Check @https://nonexistent.example" , "/test" , mockUrlContentFetcher )
5252
5353 expect ( vscode . window . showErrorMessage ) . toHaveBeenCalledWith ( "common:errors.url_fetch_error_with_url" )
54- expect ( result ) . toContain ( "Error fetching content: net::ERR_NAME_NOT_RESOLVED" )
54+ expect ( result . text ) . toContain ( "Error fetching content: net::ERR_NAME_NOT_RESOLVED" )
5555 } )
5656
5757 it ( "should handle network disconnection errors" , async ( ) => {
@@ -61,7 +61,7 @@ describe("parseMentions - URL error handling", () => {
6161 const result = await parseMentions ( "Check @https://example.com" , "/test" , mockUrlContentFetcher )
6262
6363 expect ( vscode . window . showErrorMessage ) . toHaveBeenCalledWith ( "common:errors.url_fetch_error_with_url" )
64- expect ( result ) . toContain ( "Error fetching content: net::ERR_INTERNET_DISCONNECTED" )
64+ expect ( result . text ) . toContain ( "Error fetching content: net::ERR_INTERNET_DISCONNECTED" )
6565 } )
6666
6767 it ( "should handle 403 Forbidden errors" , async ( ) => {
@@ -71,7 +71,7 @@ describe("parseMentions - URL error handling", () => {
7171 const result = await parseMentions ( "Check @https://example.com" , "/test" , mockUrlContentFetcher )
7272
7373 expect ( vscode . window . showErrorMessage ) . toHaveBeenCalledWith ( "common:errors.url_fetch_error_with_url" )
74- expect ( result ) . toContain ( "Error fetching content: 403 Forbidden" )
74+ expect ( result . text ) . toContain ( "Error fetching content: 403 Forbidden" )
7575 } )
7676
7777 it ( "should handle 404 Not Found errors" , async ( ) => {
@@ -81,7 +81,7 @@ describe("parseMentions - URL error handling", () => {
8181 const result = await parseMentions ( "Check @https://example.com/missing" , "/test" , mockUrlContentFetcher )
8282
8383 expect ( vscode . window . showErrorMessage ) . toHaveBeenCalledWith ( "common:errors.url_fetch_error_with_url" )
84- expect ( result ) . toContain ( "Error fetching content: 404 Not Found" )
84+ expect ( result . text ) . toContain ( "Error fetching content: 404 Not Found" )
8585 } )
8686
8787 it ( "should handle generic errors with fallback message" , async ( ) => {
@@ -91,7 +91,7 @@ describe("parseMentions - URL error handling", () => {
9191 const result = await parseMentions ( "Check @https://example.com" , "/test" , mockUrlContentFetcher )
9292
9393 expect ( vscode . window . showErrorMessage ) . toHaveBeenCalledWith ( "common:errors.url_fetch_error_with_url" )
94- expect ( result ) . toContain ( "Error fetching content: Some unexpected error" )
94+ expect ( result . text ) . toContain ( "Error fetching content: Some unexpected error" )
9595 } )
9696
9797 it ( "should handle non-Error objects thrown" , async ( ) => {
@@ -101,7 +101,7 @@ describe("parseMentions - URL error handling", () => {
101101 const result = await parseMentions ( "Check @https://example.com" , "/test" , mockUrlContentFetcher )
102102
103103 expect ( vscode . window . showErrorMessage ) . toHaveBeenCalledWith ( "common:errors.url_fetch_error_with_url" )
104- expect ( result ) . toContain ( "Error fetching content:" )
104+ expect ( result . text ) . toContain ( "Error fetching content:" )
105105 } )
106106
107107 it ( "should handle browser launch errors correctly" , async ( ) => {
@@ -113,7 +113,7 @@ describe("parseMentions - URL error handling", () => {
113113 expect ( vscode . window . showErrorMessage ) . toHaveBeenCalledWith (
114114 "Error fetching content for https://example.com: Failed to launch browser" ,
115115 )
116- expect ( result ) . toContain ( "Error fetching content: Failed to launch browser" )
116+ expect ( result . text ) . toContain ( "Error fetching content: Failed to launch browser" )
117117 // Should not attempt to fetch URL if browser launch failed
118118 expect ( mockUrlContentFetcher . urlToMarkdown ) . not . toHaveBeenCalled ( )
119119 } )
@@ -127,7 +127,7 @@ describe("parseMentions - URL error handling", () => {
127127 expect ( vscode . window . showErrorMessage ) . toHaveBeenCalledWith (
128128 "Error fetching content for https://example.com: String error" ,
129129 )
130- expect ( result ) . toContain ( "Error fetching content: String error" )
130+ expect ( result . text ) . toContain ( "Error fetching content: String error" )
131131 } )
132132
133133 it ( "should successfully fetch URL content when no errors occur" , async ( ) => {
@@ -136,9 +136,9 @@ describe("parseMentions - URL error handling", () => {
136136 const result = await parseMentions ( "Check @https://example.com" , "/test" , mockUrlContentFetcher )
137137
138138 expect ( vscode . window . showErrorMessage ) . not . toHaveBeenCalled ( )
139- expect ( result ) . toContain ( '<url_content url="https://example.com">' )
140- expect ( result ) . toContain ( "# Example Content\n\nThis is the content." )
141- expect ( result ) . toContain ( "</url_content>" )
139+ expect ( result . text ) . toContain ( '<url_content url="https://example.com">' )
140+ expect ( result . text ) . toContain ( "# Example Content\n\nThis is the content." )
141+ expect ( result . text ) . toContain ( "</url_content>" )
142142 } )
143143
144144 it ( "should handle multiple URLs with mixed success and failure" , async ( ) => {
@@ -152,9 +152,9 @@ describe("parseMentions - URL error handling", () => {
152152 mockUrlContentFetcher ,
153153 )
154154
155- expect ( result ) . toContain ( '<url_content url="https://example1.com">' )
156- expect ( result ) . toContain ( "# First Site" )
157- expect ( result ) . toContain ( '<url_content url="https://example2.com">' )
158- expect ( result ) . toContain ( "Error fetching content: timeout" )
155+ expect ( result . text ) . toContain ( '<url_content url="https://example1.com">' )
156+ expect ( result . text ) . toContain ( "# First Site" )
157+ expect ( result . text ) . toContain ( '<url_content url="https://example2.com">' )
158+ expect ( result . text ) . toContain ( "Error fetching content: timeout" )
159159 } )
160160} )
0 commit comments