@@ -40,7 +40,7 @@ describe("parseMentions - URL error handling", () => {
4040
4141 expect ( consoleErrorSpy ) . toHaveBeenCalledWith ( "Error fetching URL https://example.com:" , timeoutError )
4242 expect ( vscode . window . showErrorMessage ) . toHaveBeenCalledWith ( "common:errors.url_fetch_error_with_url" )
43- expect ( result ) . toContain ( "Error fetching content: Navigation timeout of 30000 ms exceeded" )
43+ expect ( result . text ) . toContain ( "Error fetching content: Navigation timeout of 30000 ms exceeded" )
4444 } )
4545
4646 it ( "should handle DNS resolution errors" , async ( ) => {
@@ -50,7 +50,7 @@ describe("parseMentions - URL error handling", () => {
5050 const result = await parseMentions ( "Check @https://nonexistent.example" , "/test" , mockUrlContentFetcher )
5151
5252 expect ( vscode . window . showErrorMessage ) . toHaveBeenCalledWith ( "common:errors.url_fetch_error_with_url" )
53- expect ( result ) . toContain ( "Error fetching content: net::ERR_NAME_NOT_RESOLVED" )
53+ expect ( result . text ) . toContain ( "Error fetching content: net::ERR_NAME_NOT_RESOLVED" )
5454 } )
5555
5656 it ( "should handle network disconnection errors" , async ( ) => {
@@ -60,7 +60,7 @@ describe("parseMentions - URL error handling", () => {
6060 const result = await parseMentions ( "Check @https://example.com" , "/test" , mockUrlContentFetcher )
6161
6262 expect ( vscode . window . showErrorMessage ) . toHaveBeenCalledWith ( "common:errors.url_fetch_error_with_url" )
63- expect ( result ) . toContain ( "Error fetching content: net::ERR_INTERNET_DISCONNECTED" )
63+ expect ( result . text ) . toContain ( "Error fetching content: net::ERR_INTERNET_DISCONNECTED" )
6464 } )
6565
6666 it ( "should handle 403 Forbidden errors" , async ( ) => {
@@ -70,7 +70,7 @@ describe("parseMentions - URL error handling", () => {
7070 const result = await parseMentions ( "Check @https://example.com" , "/test" , mockUrlContentFetcher )
7171
7272 expect ( vscode . window . showErrorMessage ) . toHaveBeenCalledWith ( "common:errors.url_fetch_error_with_url" )
73- expect ( result ) . toContain ( "Error fetching content: 403 Forbidden" )
73+ expect ( result . text ) . toContain ( "Error fetching content: 403 Forbidden" )
7474 } )
7575
7676 it ( "should handle 404 Not Found errors" , async ( ) => {
@@ -80,7 +80,7 @@ describe("parseMentions - URL error handling", () => {
8080 const result = await parseMentions ( "Check @https://example.com/missing" , "/test" , mockUrlContentFetcher )
8181
8282 expect ( vscode . window . showErrorMessage ) . toHaveBeenCalledWith ( "common:errors.url_fetch_error_with_url" )
83- expect ( result ) . toContain ( "Error fetching content: 404 Not Found" )
83+ expect ( result . text ) . toContain ( "Error fetching content: 404 Not Found" )
8484 } )
8585
8686 it ( "should handle generic errors with fallback message" , async ( ) => {
@@ -90,7 +90,7 @@ describe("parseMentions - URL error handling", () => {
9090 const result = await parseMentions ( "Check @https://example.com" , "/test" , mockUrlContentFetcher )
9191
9292 expect ( vscode . window . showErrorMessage ) . toHaveBeenCalledWith ( "common:errors.url_fetch_error_with_url" )
93- expect ( result ) . toContain ( "Error fetching content: Some unexpected error" )
93+ expect ( result . text ) . toContain ( "Error fetching content: Some unexpected error" )
9494 } )
9595
9696 it ( "should handle non-Error objects thrown" , async ( ) => {
@@ -100,7 +100,7 @@ describe("parseMentions - URL error handling", () => {
100100 const result = await parseMentions ( "Check @https://example.com" , "/test" , mockUrlContentFetcher )
101101
102102 expect ( vscode . window . showErrorMessage ) . toHaveBeenCalledWith ( "common:errors.url_fetch_error_with_url" )
103- expect ( result ) . toContain ( "Error fetching content:" )
103+ expect ( result . text ) . toContain ( "Error fetching content:" )
104104 } )
105105
106106 it ( "should handle browser launch errors correctly" , async ( ) => {
@@ -112,7 +112,7 @@ describe("parseMentions - URL error handling", () => {
112112 expect ( vscode . window . showErrorMessage ) . toHaveBeenCalledWith (
113113 "Error fetching content for https://example.com: Failed to launch browser" ,
114114 )
115- expect ( result ) . toContain ( "Error fetching content: Failed to launch browser" )
115+ expect ( result . text ) . toContain ( "Error fetching content: Failed to launch browser" )
116116 // Should not attempt to fetch URL if browser launch failed
117117 expect ( mockUrlContentFetcher . urlToMarkdown ) . not . toHaveBeenCalled ( )
118118 } )
@@ -126,7 +126,7 @@ describe("parseMentions - URL error handling", () => {
126126 expect ( vscode . window . showErrorMessage ) . toHaveBeenCalledWith (
127127 "Error fetching content for https://example.com: String error" ,
128128 )
129- expect ( result ) . toContain ( "Error fetching content: String error" )
129+ expect ( result . text ) . toContain ( "Error fetching content: String error" )
130130 } )
131131
132132 it ( "should successfully fetch URL content when no errors occur" , async ( ) => {
@@ -135,9 +135,9 @@ describe("parseMentions - URL error handling", () => {
135135 const result = await parseMentions ( "Check @https://example.com" , "/test" , mockUrlContentFetcher )
136136
137137 expect ( vscode . window . showErrorMessage ) . not . toHaveBeenCalled ( )
138- expect ( result ) . toContain ( '<url_content url="https://example.com">' )
139- expect ( result ) . toContain ( "# Example Content\n\nThis is the content." )
140- expect ( result ) . toContain ( "</url_content>" )
138+ expect ( result . text ) . toContain ( '<url_content url="https://example.com">' )
139+ expect ( result . text ) . toContain ( "# Example Content\n\nThis is the content." )
140+ expect ( result . text ) . toContain ( "</url_content>" )
141141 } )
142142
143143 it ( "should handle multiple URLs with mixed success and failure" , async ( ) => {
@@ -151,9 +151,9 @@ describe("parseMentions - URL error handling", () => {
151151 mockUrlContentFetcher ,
152152 )
153153
154- expect ( result ) . toContain ( '<url_content url="https://example1.com">' )
155- expect ( result ) . toContain ( "# First Site" )
156- expect ( result ) . toContain ( '<url_content url="https://example2.com">' )
157- expect ( result ) . toContain ( "Error fetching content: timeout" )
154+ expect ( result . text ) . toContain ( '<url_content url="https://example1.com">' )
155+ expect ( result . text ) . toContain ( "# First Site" )
156+ expect ( result . text ) . toContain ( '<url_content url="https://example2.com">' )
157+ expect ( result . text ) . toContain ( "Error fetching content: timeout" )
158158 } )
159159} )
0 commit comments