@@ -15,27 +15,27 @@ beforeEach(() => {
1515} ) ;
1616
1717describe ( 'limit rate is disabed' , ( ) => {
18- it ( 'empty limit rate options' , ( ) => {
18+ it ( 'empty limit rate options' , async ( ) => {
1919 const limitRate : LimitRate = { } ;
2020
21- expect ( isLimitRateHit ( location . pathname , limitRate , storage ) ) . toBeFalsy ( ) ;
21+ expect ( await isLimitRateHit ( location . pathname , limitRate , storage ) ) . toBeFalsy ( ) ;
2222 } ) ;
2323
24- it ( 'throttle is 0' , ( ) => {
24+ it ( 'throttle is 0' , async ( ) => {
2525 const limitRate : LimitRate = {
2626 throttle : 0 ,
2727 } ;
2828
29- expect ( isLimitRateHit ( location . pathname , limitRate , storage ) ) . toBeFalsy ( ) ;
29+ expect ( await isLimitRateHit ( location . pathname , limitRate , storage ) ) . toBeFalsy ( ) ;
3030 } ) ;
3131
32- it ( 'no record' , ( ) => {
32+ it ( 'no record' , async ( ) => {
3333 const limitRate : LimitRate = {
3434 id : 'app' ,
3535 throttle : 1000 ,
3636 } ;
3737
38- expect ( isLimitRateHit ( location . pathname , limitRate , storage ) ) . toBeFalsy ( ) ;
38+ expect ( await isLimitRateHit ( location . pathname , limitRate , storage ) ) . toBeFalsy ( ) ;
3939 } ) ;
4040
4141 it ( 'no hit limit' , async ( ) => {
@@ -44,59 +44,59 @@ describe('limit rate is disabed', () => {
4444 throttle : 100 ,
4545 } ;
4646
47- expect ( isLimitRateHit ( location . pathname , limitRate , storage ) ) . toBeFalsy ( ) ;
47+ expect ( await isLimitRateHit ( location . pathname , limitRate , storage ) ) . toBeFalsy ( ) ;
4848
4949 await new Promise ( ( r ) => setTimeout ( r , 150 ) ) ;
5050
51- expect ( isLimitRateHit ( location . pathname , limitRate , storage ) ) . toBeFalsy ( ) ;
51+ expect ( await isLimitRateHit ( location . pathname , limitRate , storage ) ) . toBeFalsy ( ) ;
5252 } ) ;
5353
54- it ( 'not same page or ID' , ( ) => {
54+ it ( 'not same page or ID' , async ( ) => {
5555 const limitRate : LimitRate = {
5656 throttle : 100 ,
5757 } ;
5858
59- expect ( isLimitRateHit ( location . pathname , limitRate , storage ) ) . toBeFalsy ( ) ;
59+ expect ( await isLimitRateHit ( location . pathname , limitRate , storage ) ) . toBeFalsy ( ) ;
6060
6161 location . replace ( '/new-form' ) ;
6262
63- expect ( isLimitRateHit ( location . pathname , limitRate , storage ) ) . toBeFalsy ( ) ;
63+ expect ( await isLimitRateHit ( location . pathname , limitRate , storage ) ) . toBeFalsy ( ) ;
6464 } ) ;
6565} ) ;
6666
6767describe ( 'limit rate is enabled' , ( ) => {
68- it ( 'hit limit' , ( ) => {
68+ it ( 'hit limit' , async ( ) => {
6969 const limitRate : LimitRate = {
7070 id : 'app' ,
7171 throttle : 100 ,
7272 } ;
7373
74- expect ( isLimitRateHit ( location . pathname , limitRate , storage ) ) . toBeFalsy ( ) ;
75- expect ( isLimitRateHit ( location . pathname , limitRate , storage ) ) . toBeTruthy ( ) ;
74+ expect ( await isLimitRateHit ( location . pathname , limitRate , storage ) ) . toBeFalsy ( ) ;
75+ expect ( await isLimitRateHit ( location . pathname , limitRate , storage ) ) . toBeTruthy ( ) ;
7676 } ) ;
7777
78- it ( 'restore after page refresh and hit limit' , ( ) => {
78+ it ( 'restore after page refresh and hit limit' , async ( ) => {
7979 const limitRate : LimitRate = {
8080 throttle : 100 ,
8181 } ;
8282
83- expect ( isLimitRateHit ( location . pathname , limitRate , storage ) ) . toBeFalsy ( ) ;
83+ expect ( await isLimitRateHit ( location . pathname , limitRate , storage ) ) . toBeFalsy ( ) ;
8484
8585 location . reload ( ) ;
8686
87- expect ( isLimitRateHit ( location . pathname , limitRate , storage ) ) . toBeTruthy ( ) ;
87+ expect ( await isLimitRateHit ( location . pathname , limitRate , storage ) ) . toBeTruthy ( ) ;
8888 } ) ;
8989
90- it ( 'next page refresh and hit limit' , ( ) => {
90+ it ( 'next page refresh and hit limit' , async ( ) => {
9191 const limitRate : LimitRate = {
9292 id : 'app' ,
9393 throttle : 100 ,
9494 } ;
9595
96- expect ( isLimitRateHit ( location . pathname , limitRate , storage ) ) . toBeFalsy ( ) ;
96+ expect ( await isLimitRateHit ( location . pathname , limitRate , storage ) ) . toBeFalsy ( ) ;
9797
9898 location . replace ( '/new-form' ) ;
9999
100- expect ( isLimitRateHit ( location . pathname , limitRate , storage ) ) . toBeTruthy ( ) ;
100+ expect ( await isLimitRateHit ( location . pathname , limitRate , storage ) ) . toBeTruthy ( ) ;
101101 } ) ;
102102} ) ;
0 commit comments