From a32f7e568e0aa503f6bd5cf6a0c9b1e19e642ff8 Mon Sep 17 00:00:00 2001 From: Alan Xu Date: Thu, 18 Jan 2024 22:25:27 +0800 Subject: [PATCH] test(allowed_hosts_validator_test.go): add test case add test case --- authentication/allowed_hosts_validator.go | 2 +- authentication/allowed_hosts_validator_test.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/authentication/allowed_hosts_validator.go b/authentication/allowed_hosts_validator.go index 805be5f..3556526 100644 --- a/authentication/allowed_hosts_validator.go +++ b/authentication/allowed_hosts_validator.go @@ -25,7 +25,7 @@ func NewAllowedHostsValidator(validHosts []string) AllowedHostsValidator { func NewAllowedHostsValidatorErrorCheck(validHosts []string) (*AllowedHostsValidator, error) { result := &AllowedHostsValidator{} if err := result.SetAllowedHostsErrorCheck(validHosts); err != nil { - return result, err + return nil, err } return result, nil } diff --git a/authentication/allowed_hosts_validator_test.go b/authentication/allowed_hosts_validator_test.go index 4a94bfd..312f387 100644 --- a/authentication/allowed_hosts_validator_test.go +++ b/authentication/allowed_hosts_validator_test.go @@ -15,6 +15,7 @@ func TestItValidatesHostsUseNewAllowedHostsValidator(t *testing.T) { } func TestItValidatesHostsUseNewAllowedHostsValidatorErrorCheck(t *testing.T) { - _, err := NewAllowedHostsValidatorErrorCheck([]string{"http://graph.microsoft.com"}) + validator, err := NewAllowedHostsValidatorErrorCheck([]string{"http://graph.microsoft.com"}) assert.EqualValues(t, ErrInvalidHostPrefix, err) + assert.Nil(t, validator) }