(t *testing.T)
| 168 | } |
| 169 | |
| 170 | func TestValidArgsGetCatalogs(t *testing.T) { |
| 171 | type args struct { |
| 172 | in0 *cobra.Command |
| 173 | args []string |
| 174 | toComplete string |
| 175 | } |
| 176 | tests := []struct { |
| 177 | name string |
| 178 | args args |
| 179 | want assert.Want[[]string] |
| 180 | want1 cobra.ShellCompDirective |
| 181 | }{ |
| 182 | { |
| 183 | name: "some catalogs", |
| 184 | args: args{ |
| 185 | toComplete: "", |
| 186 | }, |
| 187 | want: func(t *testing.T, got []string) bool { |
| 188 | return assert.Contains(t, got, fmt.Sprintf("%s\t%s: %s", testdata.MockCatalogID, testdata.MockCatalogName, testdata.MockCatalogDescription)) |
| 189 | }, |
| 190 | want1: cobra.ShellCompDirectiveNoFileComp, |
| 191 | }, |
| 192 | { |
| 193 | name: "all args - return nothing", |
| 194 | args: args{ |
| 195 | args: []string{testdata.MockCatalogID}, |
| 196 | toComplete: "", |
| 197 | }, |
| 198 | want: assert.Empty[[]string], |
| 199 | want1: cobra.ShellCompDirectiveNoFileComp, |
| 200 | }, |
| 201 | } |
| 202 | |
| 203 | for _, tt := range tests { |
| 204 | t.Run(tt.name, func(t *testing.T) { |
| 205 | got, got1 := cli.ValidArgsGetCatalogs(tt.args.in0, tt.args.args, tt.args.toComplete) |
| 206 | tt.want(t, got) |
| 207 | assert.Equal(t, tt.want1, got1) |
| 208 | }) |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | func TestValidArgsGetCategory(t *testing.T) { |
| 213 | type args struct { |
nothing calls this directly
no test coverage detected