Skip to content

Commit

Permalink
test(allowed_hosts_validator_test.go): add test case
Browse files Browse the repository at this point in the history
add test case
  • Loading branch information
XdpCs committed Jan 18, 2024
1 parent 47d9018 commit a32f7e5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion authentication/allowed_hosts_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
3 changes: 2 additions & 1 deletion authentication/allowed_hosts_validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

0 comments on commit a32f7e5

Please sign in to comment.