@@ -112,54 +112,54 @@ t.test("ip blocking works", async () => {
112112 ] ,
113113 [ ]
114114 ) ;
115- t . same ( config . isIPAddressBlocked ( "1.2.3.4" ) , [
115+ t . same ( config . getBlockedIPAddresses ( "1.2.3.4" ) , [
116116 {
117117 key : "geoip/Belgium;BE" ,
118118 monitor : false ,
119119 reason : "description" ,
120120 } ,
121121 ] ) ;
122- t . same ( config . isIPAddressBlocked ( "2.3.4.5" ) , [ ] ) ;
123- t . same ( config . isIPAddressBlocked ( "192.168.2.2" ) , [
122+ t . same ( config . getBlockedIPAddresses ( "2.3.4.5" ) , [ ] ) ;
123+ t . same ( config . getBlockedIPAddresses ( "192.168.2.2" ) , [
124124 {
125125 key : "geoip/Belgium;BE" ,
126126 monitor : false ,
127127 reason : "description" ,
128128 } ,
129129 ] ) ;
130- t . same ( config . isIPAddressBlocked ( "fd00:1234:5678:9abc::1" ) , [
130+ t . same ( config . getBlockedIPAddresses ( "fd00:1234:5678:9abc::1" ) , [
131131 {
132132 key : "geoip/Belgium;BE" ,
133133 monitor : false ,
134134 reason : "description" ,
135135 } ,
136136 ] ) ;
137- t . same ( config . isIPAddressBlocked ( "fd00:1234:5678:9abc::2" ) , [ ] ) ;
138- t . same ( config . isIPAddressBlocked ( "fd00:3234:5678:9abc::1" ) , [
137+ t . same ( config . getBlockedIPAddresses ( "fd00:1234:5678:9abc::2" ) , [ ] ) ;
138+ t . same ( config . getBlockedIPAddresses ( "fd00:3234:5678:9abc::1" ) , [
139139 {
140140 key : "geoip/Belgium;BE" ,
141141 monitor : false ,
142142 reason : "description" ,
143143 } ,
144144 ] ) ;
145- t . same ( config . isIPAddressBlocked ( "fd00:3234:5678:9abc::2" ) , [
145+ t . same ( config . getBlockedIPAddresses ( "fd00:3234:5678:9abc::2" ) , [
146146 {
147147 key : "geoip/Belgium;BE" ,
148148 monitor : false ,
149149 reason : "description" ,
150150 } ,
151151 ] ) ;
152- t . same ( config . isIPAddressBlocked ( "5.6.7.8" ) , [
152+ t . same ( config . getBlockedIPAddresses ( "5.6.7.8" ) , [
153153 {
154154 key : "geoip/Belgium;BE" ,
155155 monitor : false ,
156156 reason : "description" ,
157157 } ,
158158 ] ) ;
159- t . same ( config . isIPAddressBlocked ( "1.2" ) , [ ] ) ;
159+ t . same ( config . getBlockedIPAddresses ( "1.2" ) , [ ] ) ;
160160
161161 config . updateBlockedIPAddresses ( [ ] ) ;
162- t . same ( config . isIPAddressBlocked ( "1.2.3.4" ) , [ ] ) ;
162+ t . same ( config . getBlockedIPAddresses ( "1.2.3.4" ) , [ ] ) ;
163163} ) ;
164164
165165t . test ( "update blocked IPs contains empty IPs" , async ( t ) => {
@@ -173,7 +173,7 @@ t.test("update blocked IPs contains empty IPs", async (t) => {
173173 monitor : false ,
174174 } ,
175175 ] ) ;
176- t . same ( config . isIPAddressBlocked ( "1.2.3.4" ) , [ ] ) ;
176+ t . same ( config . getBlockedIPAddresses ( "1.2.3.4" ) , [ ] ) ;
177177} ) ;
178178
179179t . test ( "it blocks bots" , async ( ) => {
@@ -186,23 +186,23 @@ t.test("it blocks bots", async () => {
186186 } ,
187187 ] ) ;
188188
189- t . same ( config . isUserAgentBlocked ( "googlebot" ) , [
189+ t . same ( config . getBlockedUserAgents ( "googlebot" ) , [
190190 {
191191 key : "test" ,
192192 monitor : false ,
193193 } ,
194194 ] ) ;
195- t . same ( config . isUserAgentBlocked ( "123 bingbot abc" ) , [
195+ t . same ( config . getBlockedUserAgents ( "123 bingbot abc" ) , [
196196 {
197197 key : "test" ,
198198 monitor : false ,
199199 } ,
200200 ] ) ;
201- t . same ( config . isUserAgentBlocked ( "bing" ) , [ ] ) ;
201+ t . same ( config . getBlockedUserAgents ( "bing" ) , [ ] ) ;
202202
203203 config . updateBlockedUserAgents ( [ ] ) ;
204204
205- t . same ( config . isUserAgentBlocked ( "googlebot" ) , [ ] ) ;
205+ t . same ( config . getBlockedUserAgents ( "googlebot" ) , [ ] ) ;
206206} ) ;
207207
208208t . test ( "restricting access to some ips" , async ( ) => {
@@ -320,13 +320,13 @@ t.test("should return all matching user agent patterns", async (t) => {
320320 monitor : false ,
321321 } ,
322322 ] ) ;
323- t . same ( config . isUserAgentBlocked ( "googlebot" ) , [
323+ t . same ( config . getBlockedUserAgents ( "googlebot" ) , [
324324 {
325325 key : "bots" ,
326326 monitor : false ,
327327 } ,
328328 ] ) ;
329- t . same ( config . isUserAgentBlocked ( "firefox" ) , [ ] ) ;
329+ t . same ( config . getBlockedUserAgents ( "firefox" ) , [ ] ) ;
330330} ) ;
331331
332332t . test ( "it returns and updates blocked user agents" , async ( t ) => {
@@ -343,7 +343,7 @@ t.test("it returns and updates blocked user agents", async (t) => {
343343 monitor : true ,
344344 } ,
345345 ] ) ;
346- t . same ( config . isUserAgentBlocked ( "googlebot" ) , [
346+ t . same ( config . getBlockedUserAgents ( "googlebot" ) , [
347347 {
348348 key : "bots" ,
349349 monitor : false ,
@@ -353,17 +353,17 @@ t.test("it returns and updates blocked user agents", async (t) => {
353353 monitor : true ,
354354 } ,
355355 ] ) ;
356- t . same ( config . isUserAgentBlocked ( "bingbot" ) , [
356+ t . same ( config . getBlockedUserAgents ( "bingbot" ) , [
357357 {
358358 key : "bots" ,
359359 monitor : false ,
360360 } ,
361361 ] ) ;
362362
363363 config . updateBlockedUserAgents ( [ ] ) ;
364- t . same ( config . isUserAgentBlocked ( "googlebot" ) , [ ] ) ;
365- t . same ( config . isUserAgentBlocked ( "bingbot" ) , [ ] ) ;
366- t . same ( config . isUserAgentBlocked ( "firefox" ) , [ ] ) ;
364+ t . same ( config . getBlockedUserAgents ( "googlebot" ) , [ ] ) ;
365+ t . same ( config . getBlockedUserAgents ( "bingbot" ) , [ ] ) ;
366+ t . same ( config . getBlockedUserAgents ( "firefox" ) , [ ] ) ;
367367} ) ;
368368
369369t . test ( "it ignores user agent lists with empty patterns" , async ( t ) => {
@@ -375,7 +375,7 @@ t.test("it ignores user agent lists with empty patterns", async (t) => {
375375 monitor : false ,
376376 } ,
377377 ] ) ;
378- t . same ( config . isUserAgentBlocked ( "googlebot" ) , [ ] ) ;
378+ t . same ( config . getBlockedUserAgents ( "googlebot" ) , [ ] ) ;
379379} ) ;
380380
381381t . test (
@@ -389,6 +389,6 @@ t.test(
389389 monitor : false ,
390390 } ,
391391 ] ) ;
392- t . same ( config . isUserAgentBlocked ( "googlebot" ) , [ ] ) ;
392+ t . same ( config . getBlockedUserAgents ( "googlebot" ) , [ ] ) ;
393393 }
394394) ;
0 commit comments