-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: fixing UT and adding HasCapability function (#7)
chore: fixing UT and adding HasCapability function Signed-off-by: Pritesh Bandi <[email protected]>
- Loading branch information
1 parent
c077eda
commit e3d2a30
Showing
4 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package plugin | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestGetMetadataResponse_HasCapability(t *testing.T) { | ||
type args struct { | ||
capability Capability | ||
} | ||
tests := []struct { | ||
name string | ||
m *GetMetadataResponse | ||
args args | ||
want bool | ||
}{ | ||
{"empty capabilities", &GetMetadataResponse{}, args{"cap"}, false}, | ||
{"other capabilities", &GetMetadataResponse{Capabilities: []Capability{"foo", "baz"}}, args{"cap"}, false}, | ||
{"empty target capability", &GetMetadataResponse{Capabilities: []Capability{"foo", "baz"}}, args{""}, true}, | ||
{"found", &GetMetadataResponse{Capabilities: []Capability{"foo", "baz"}}, args{"baz"}, true}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
if got := tt.m.HasCapability(tt.args.capability); got != tt.want { | ||
t.Errorf("GetMetadataResponse.HasCapability() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} |