mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-22 07:26:50 +00:00
Expand config test coverage
This commit is contained in:
@@ -90,8 +90,8 @@ func NewRateLimit(d time.Duration, rate int) *RateLimit {
|
||||
return &RateLimit{Duration: d, Rate: rate}
|
||||
}
|
||||
|
||||
// ToString returns the rate limiter in string notation
|
||||
func (r *RateLimit) ToString() string {
|
||||
// String returns the rate limiter in string notation
|
||||
func (r *RateLimit) String() string {
|
||||
return fmt.Sprintf("Rate limiter set to %d requests per %v", r.Rate, r.Duration)
|
||||
}
|
||||
|
||||
|
||||
@@ -66,15 +66,15 @@ func TestIsRateLimited(t *testing.T) {
|
||||
r := New("bitfinex", NewRateLimit(time.Second*10, 5), NewRateLimit(time.Second*20, 100), new(http.Client))
|
||||
r.StartCycle()
|
||||
|
||||
if r.AuthLimit.ToString() != "Rate limiter set to 5 requests per 10s" {
|
||||
if r.AuthLimit.String() != "Rate limiter set to 5 requests per 10s" {
|
||||
t.Fatal("unexcpted values")
|
||||
}
|
||||
|
||||
if r.UnauthLimit.ToString() != "Rate limiter set to 100 requests per 20s" {
|
||||
if r.UnauthLimit.String() != "Rate limiter set to 100 requests per 20s" {
|
||||
t.Fatal("unexpected values")
|
||||
}
|
||||
|
||||
if r.AuthLimit.ToString() != "Rate limiter set to 5 requests per 10s" {
|
||||
if r.AuthLimit.String() != "Rate limiter set to 5 requests per 10s" {
|
||||
t.Fatal("unexcpted values")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user