Wrong type in Errorf()

This commit is contained in:
Winni Neessen 2021-09-21 19:47:17 +02:00
parent f7588a863c
commit a50a8603eb

View file

@ -1,6 +1,7 @@
package hibp
import (
"os"
"testing"
"time"
)
@ -38,3 +39,17 @@ func TestNewWithPwnedPadding(t *testing.T) {
true, hc.PwnedPassApiOpts.WithPadding)
}
}
// TestNewWithApiKey tests the New() function with the API key set
func TestNewWithApiKey(t *testing.T) {
apiKey := os.Getenv("HIBP_API_KEY")
hc := New(WithApiKey(apiKey))
if hc == nil {
t.Errorf("hibp client creation failed")
return
}
if hc.ak != apiKey {
t.Errorf("hibp client API key was not set properly. Expected %s, got: %s",
apiKey, hc.ak)
}
}