@@ -123,18 +123,27 @@ func TestImageFlag(t *testing.T) {
123123}
124124
125125func 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
140149func TestStatsFlag (t * testing.T ) {
0 commit comments