Skip to content

Commit

Permalink
update unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: razzle <harry@razzle.cloud>
  • Loading branch information
Noxsios committed Mar 15, 2024
1 parent d58a945 commit e052172
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/pkg/packager/filters/deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,42 @@ func TestDeployFilter_Apply(t *testing.T) {
componentFromQuery(t, "required=<nil> && group=bar && idx=5 && default=false"),
},
},
"Test failing when group has no default and no selection was made": {
pkg: types.ZarfPackage{
Build: types.ZarfBuildData{
Version: "v0.32.0",
},
Components: []types.ZarfComponent{
componentFromQuery(t, "group=foo && default=false"),
componentFromQuery(t, "group=foo && default=false"),
},
},
optionalComponents: "",
expectedErr: ErrNoDefaultOrSelection,
},
"Test failing when multiple are selected from the same group": {
pkg: types.ZarfPackage{
Build: types.ZarfBuildData{
Version: "v0.32.0",
},
Components: []types.ZarfComponent{
componentFromQuery(t, "group=foo && default=true"),
componentFromQuery(t, "group=foo && default=false"),
},
},
optionalComponents: strings.Join([]string{"group=foo && default=false", "group=foo && default=true"}, ","),
expectedErr: ErrMultipleSameGroup,
},
"Test failing when no components are found that match the query": {
pkg: types.ZarfPackage{
Build: types.ZarfBuildData{
Version: "v0.32.0",
},
Components: possibilities,
},
optionalComponents: "nonexistent",
expectedErr: ErrNotFound,
},
}

for name, tc := range testCases {
Expand Down

0 comments on commit e052172

Please sign in to comment.