Skip to content

Commit

Permalink
feat: increase test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
1995parham committed Nov 30, 2023
1 parent 7c9750e commit a33638a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/authenticator/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ func (b Builder) GetAllowedAccessTypes(accessTypes []string) []acl.AccessType {
// toUserAccessType will convert string access type to it's own type.
func toUserAccessType(access string) (acl.AccessType, error) {
switch access {
case "pub":
case "pub", "publish":
return acl.Pub, nil
case "sub":
case "sub", "subscribe":
return acl.Sub, nil
case "pubsub":
case "pubsub", "subpub":
return acl.PubSub, nil
}

Expand Down
30 changes: 30 additions & 0 deletions internal/authenticator/builder_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,36 @@ func TestToUserAccessType(t *testing.T) {
expected: acl.Pub,
expectedErr: nil,
},
{
name: "success",
input: "publish",
expected: acl.Pub,
expectedErr: nil,
},
{
name: "success",
input: "sub",
expected: acl.Sub,
expectedErr: nil,
},
{
name: "success",
input: "subscribe",
expected: acl.Sub,
expectedErr: nil,
},
{
name: "success",
input: "pubsub",
expected: acl.PubSub,
expectedErr: nil,
},
{
name: "success",
input: "subpub",
expected: acl.PubSub,
expectedErr: nil,
},
{
name: "failed",
input: "-",
Expand Down

0 comments on commit a33638a

Please sign in to comment.