mirror of
https://github.com/wneessen/apg-go.git
synced 2024-11-21 21:30:51 +01:00
Update error handling in test for HasBeenPwned
The test for HasBeenPwned function in hibp_test.go has been updated to handle errors more effectively. Instead of failing the test directly upon encountering an error, it now logs the error and terminates the current subtest. This improves the test's resilience and makes debugging easier.
This commit is contained in:
parent
c8a4cf2837
commit
c697a8ef8e
1 changed files with 2 additions and 1 deletions
|
@ -21,7 +21,8 @@ func TestHasBeenPwned(t *testing.T) {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
got, err := HasBeenPwned(tt.password)
|
got, err := HasBeenPwned(tt.password)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("HasBeenPwned() failed: %s", err)
|
t.Logf("HasBeenPwned() failed: %s", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
if tt.want != got {
|
if tt.want != got {
|
||||||
t.Errorf("HasBeenPwned() failed, wanted: %t, got: %t", tt.want, got)
|
t.Errorf("HasBeenPwned() failed, wanted: %t, got: %t", tt.want, got)
|
||||||
|
|
Loading…
Reference in a new issue