@@ -128,20 +128,24 @@ responses by hand.`);
128128 await expect ( result ) . to . have . responseText ( 'Fake file' ) ;
129129 } ) ;
130130
131- it ( "should regex match requests for a matching URL with negative regexp -- pass" , async ( ) => {
131+ it ( "should not negative-regex match requests by full URL with forX matchers" , async ( ) => {
132+ // It's not so much that this is desired behaviour - more that it follows from the
133+ // definition of forGet matching, and we want to preserve it for now, as opposed
134+ // to usage of withUrlMatching (below) which does _not_ behave like this.
135+
132136 await server . forGet ( / ^ (? ! .* l o c a l h o s t ) / ) . thenReply ( 200 , 'Fake file' ) ;
133-
137+
134138 let result = await fetch ( server . urlFor ( '/matching-file.txt' ) ) ;
135139
136- await expect ( result ) . to . have . responseText ( 'Fake file' ) ;
140+ await expect ( result ) . to . have . responseText ( 'Fake file' ) ;
137141 } ) ;
138142
139- it ( "should regex match requests for a matching URL with negative regexp -- catch " , async ( ) => {
143+ it ( "should negative- regex match requests by full URL with withUrlMatching " , async ( ) => {
140144 await server . forGet ( ) . withUrlMatching ( / ^ (? ! .* l o c a l h o s t ) / ) . thenReply ( 200 , 'Fake file' ) ;
141-
145+
142146 let result2 = await fetch ( server . urlFor ( '/matching-file.txt' ) ) ;
143147
144- await expect ( result2 ) . to . have . responseText ( / ^ .* N o r u l e s * ./ ) ;
148+ await expect ( result2 ) . to . have . responseText ( / ^ .* N o r u l e s * ./ ) ;
145149 } ) ;
146150
147151 it ( "should reject requests for the wrong path" , async ( ) => {
@@ -159,7 +163,6 @@ responses by hand.`);
159163
160164 expect ( result . status ) . to . equal ( 503 ) ;
161165 } ) ;
162-
163166
164167 it ( "should match requests ignoring the query string" , async ( ) => {
165168 await server . forGet ( '/path' ) . thenReply ( 200 , 'Matched path' ) ;
0 commit comments