@@ -37,6 +37,15 @@ func TestAllow(t *testing.T) {
3737 assert .Equal (t , res .RetryAfter , time .Duration (- 1 ))
3838 assert .InDelta (t , res .ResetAfter , 100 * time .Millisecond , float64 (10 * time .Millisecond ))
3939
40+ err = l .Reset (ctx , "test_id" )
41+ assert .Nil (t , err )
42+ res , err = l .Allow (ctx , "test_id" , limit )
43+ assert .Nil (t , err )
44+ assert .Equal (t , res .Allowed , 1 )
45+ assert .Equal (t , res .Remaining , 9 )
46+ assert .Equal (t , res .RetryAfter , time .Duration (- 1 ))
47+ assert .InDelta (t , res .ResetAfter , 100 * time .Millisecond , float64 (10 * time .Millisecond ))
48+
4049 res , err = l .AllowN (ctx , "test_id" , limit , 2 )
4150 assert .Nil (t , err )
4251 assert .Equal (t , res .Allowed , 2 )
@@ -57,6 +66,7 @@ func TestAllow(t *testing.T) {
5766 assert .Equal (t , res .Remaining , 0 )
5867 assert .InDelta (t , res .RetryAfter , 99 * time .Second , float64 (time .Second ))
5968 assert .InDelta (t , res .ResetAfter , 999 * time .Millisecond , float64 (10 * time .Millisecond ))
69+
6070}
6171
6272func TestAllowAtMost (t * testing.T ) {
0 commit comments