Skip to content

Commit 2b00fb8

Browse files
updating tests
1 parent 4f5b907 commit 2b00fb8

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

flags/pokemonflagset_test.go

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,27 @@ func TestImageFlag(t *testing.T) {
123123
}
124124

125125
func TestImageFlagOptions(t *testing.T) {
126-
validOptions := map[string]bool{
127-
"lg": true,
128-
"md": true,
129-
"sm": true,
130-
}
126+
// Define valid options as a slice
127+
validOptions := []string{"lg", "md", "sm"}
131128

132-
for option := range validOptions {
129+
// Test valid options
130+
for _, option := range validOptions {
133131
t.Run(fmt.Sprintf("ValidOption_%s", option), func(t *testing.T) {
134132
err := ImageFlag("pokemon", "bulbasaur", option)
135133
assert.NoError(t, err, fmt.Sprintf("ImageFlag should not return an error for valid option '%s'", option))
136134
})
137135
}
136+
137+
// Define invalid options as a slice
138+
invalidOptions := []string{"s", "med", "large"}
139+
140+
// Test invalid options
141+
for _, option := range invalidOptions {
142+
t.Run(fmt.Sprintf("InvalidOption_%s", option), func(t *testing.T) {
143+
err := ImageFlag("pokemon", "bulbasaur", option)
144+
assert.Error(t, err, fmt.Sprintf("ImageFlag should return an error for invalid option '%s'", option))
145+
})
146+
}
138147
}
139148

140149
func TestStatsFlag(t *testing.T) {

0 commit comments

Comments
 (0)