@@ -82,9 +82,9 @@ describe("Invalid syntax", () => {
8282 expect ( parser . errors ) . to . containSubset ( [
8383 {
8484 name : ResolverError . name ,
85- message : expectedValue => expectedValue . startsWith ( "Error opening file" ) ,
85+ message : expectedValue => expectedValue . startsWith ( "Error opening file" ) || expectedValue . endsWith ( "HTTP ERROR 404" ) ,
8686 path : [ ] ,
87- source : expectedValue => expectedValue . endsWith ( "/test/ this file does not exist" ) ,
87+ source : expectedValue => expectedValue . endsWith ( "this file does not exist" ) || expectedValue . startsWith ( "http://localhost ") ,
8888 }
8989 ] ) ;
9090 } ) ;
@@ -198,13 +198,14 @@ describe("Invalid syntax", () => {
198198 it ( "should not throw an error for an invalid file path" , async ( ) => {
199199 const parser = new $RefParser ( ) ;
200200 const result = await parser . dereference ( { foo : { $ref : "this file does not exist" } } , { failFast : false } ) ;
201+ expect ( result ) . to . deep . equal ( { foo : null } ) ;
201202 expect ( parser . errors . length ) . to . equal ( 1 ) ;
202203 expect ( parser . errors ) . to . containSubset ( [
203204 {
204205 name : ResolverError . name ,
205- message : expectedValue => expectedValue . startsWith ( "Error opening file" ) ,
206+ message : expectedValue => expectedValue . startsWith ( "Error opening file" ) || expectedValue . endsWith ( "HTTP ERROR 404" ) ,
206207 path : [ "foo" ] ,
207- source : expectedValue => expectedValue . endsWith ( "/test/" ) ,
208+ source : expectedValue => expectedValue . endsWith ( "/test/" ) || expectedValue . startsWith ( "http://localhost" ) ,
208209 }
209210 ] ) ;
210211 } ) ;
@@ -219,7 +220,7 @@ describe("Invalid syntax", () => {
219220 name : ParserError . name ,
220221 message : "incomplete explicit mapping pair; a key node is missed" ,
221222 path : [ "foo" ] ,
222- source : expectedValue => expectedValue . endsWith ( "/test/" ) ,
223+ source : expectedValue => expectedValue . endsWith ( "/test/" ) || expectedValue . startsWith ( "http://localhost" ) ,
223224 } ,
224225 ] ) ;
225226 } ) ;
@@ -234,7 +235,7 @@ describe("Invalid syntax", () => {
234235 name : ParserError . name ,
235236 message : "unexpected end of the stream within a flow collection" ,
236237 path : [ "foo" ] ,
237- source : expectedValue => expectedValue . endsWith ( "/test/" ) ,
238+ source : expectedValue => expectedValue . endsWith ( "/test/" ) || expectedValue . startsWith ( "http://localhost" ) ,
238239 }
239240 ] ) ;
240241 } ) ;
@@ -249,7 +250,7 @@ describe("Invalid syntax", () => {
249250 name : ParserError . name ,
250251 message : "CloseBraceExpected" ,
251252 path : [ "foo" ] ,
252- source : expectedValue => expectedValue . endsWith ( "/test/" ) ,
253+ source : expectedValue => expectedValue . endsWith ( "/test/" ) || expectedValue . startsWith ( "http://localhost" ) ,
253254 }
254255 ] ) ;
255256 } ) ;
0 commit comments