@@ -184,37 +184,6 @@ t.test("it rate limits localhost when not in production mode", async (t) => {
184184 } ) ;
185185} ) ;
186186
187- t . test ( "it does not rate limit when the IP is allowed" , async ( t ) => {
188- const agent = await createAgent (
189- [
190- {
191- method : "POST" ,
192- route : "/login" ,
193- forceProtectionOff : false ,
194- rateLimiting : {
195- enabled : true ,
196- maxRequests : 3 ,
197- windowSizeInMS : 1000 ,
198- } ,
199- } ,
200- ] ,
201- [ "1.2.3.4" ]
202- ) ;
203-
204- t . same ( shouldRateLimitRequest ( createContext ( "1.2.3.4" ) , agent ) , {
205- block : false ,
206- } ) ;
207- t . same ( shouldRateLimitRequest ( createContext ( "1.2.3.4" ) , agent ) , {
208- block : false ,
209- } ) ;
210- t . same ( shouldRateLimitRequest ( createContext ( "1.2.3.4" ) , agent ) , {
211- block : false ,
212- } ) ;
213- t . same ( shouldRateLimitRequest ( createContext ( "1.2.3.4" ) , agent ) , {
214- block : false ,
215- } ) ;
216- } ) ;
217-
218187t . test ( "it rate limits by user" , async ( t ) => {
219188 const agent = await createAgent ( [
220189 {
@@ -439,40 +408,6 @@ t.test(
439408 }
440409) ;
441410
442- t . test (
443- "it does not rate limit requests from allowed ip with user" ,
444- async ( t ) => {
445- const agent = await createAgent (
446- [
447- {
448- method : "POST" ,
449- route : "/login" ,
450- forceProtectionOff : false ,
451- rateLimiting : {
452- enabled : true ,
453- maxRequests : 3 ,
454- windowSizeInMS : 1000 ,
455- } ,
456- } ,
457- ] ,
458- [ "1.2.3.4" ]
459- ) ;
460-
461- t . same ( shouldRateLimitRequest ( createContext ( "1.2.3.4" , "123" ) , agent ) , {
462- block : false ,
463- } ) ;
464- t . same ( shouldRateLimitRequest ( createContext ( "1.2.3.4" , "123" ) , agent ) , {
465- block : false ,
466- } ) ;
467- t . same ( shouldRateLimitRequest ( createContext ( "1.2.3.4" , "123" ) , agent ) , {
468- block : false ,
469- } ) ;
470- t . same ( shouldRateLimitRequest ( createContext ( "1.2.3.4" , "123" ) , agent ) , {
471- block : false ,
472- } ) ;
473- }
474- ) ;
475-
476411t . test (
477412 "it does not consume rate limit for user a second time (same request)" ,
478413 async ( t ) => {
0 commit comments