(t *testing.T)
| 891 | } |
| 892 | |
| 893 | func TestRateLimitRuleDurationTime(t *testing.T) { |
| 894 | t.Parallel() |
| 895 | |
| 896 | scenarios := []struct { |
| 897 | rule core.RateLimitRule |
| 898 | expected time.Duration |
| 899 | }{ |
| 900 | {core.RateLimitRule{}, 0 * time.Second}, |
| 901 | {core.RateLimitRule{Duration: 1234}, 1234 * time.Second}, |
| 902 | } |
| 903 | |
| 904 | for i, s := range scenarios { |
| 905 | t.Run(fmt.Sprintf("%d_%d", i, s.rule.Duration), func(t *testing.T) { |
| 906 | result := s.rule.DurationTime() |
| 907 | |
| 908 | if result != s.expected { |
| 909 | t.Fatalf("Expected duration %d, got %d", s.expected, result) |
| 910 | } |
| 911 | }) |
| 912 | } |
| 913 | } |
| 914 | |
| 915 | func TestRateLimitRuleString(t *testing.T) { |
| 916 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…