Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Vadim committed Sep 3, 2024
1 parent 520b4c4 commit 554d5ff
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion limiter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ func TestLimiter_ExceedLimit(t *testing.T) {

wg.Wait()

if !limiter.IsLocked() {
t.Fatalf("Expected limiter to be locked")
}

duration := time.Since(start)
if duration < interval {
t.Fatalf("Expected at least %v wait time, but got %v", interval, duration)
Expand Down Expand Up @@ -135,7 +139,9 @@ func TestLimiter_ExceedWeightedLimit(t *testing.T) {
}

wg.Wait()

if !limiter.IsLocked() {
t.Fatalf("Expected limiter to be locked")
}
duration := time.Since(start)
if duration < interval {
t.Fatalf("Expected at least %v wait time, but got %v", interval, duration)
Expand Down

0 comments on commit 554d5ff

Please sign in to comment.