-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add minimal tests to fix coverage error
Signed-off-by: mevrin <matthieu.evrin@gmail.com>
- Loading branch information
Showing
1 changed file
with
43 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package pattern | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func Test_importPattern_DisplayErrorsMissingFlags(t *testing.T) { | ||
type args struct { | ||
sourceType string | ||
file string | ||
patternURL string | ||
save bool | ||
} | ||
|
||
tests := []struct { | ||
name string | ||
args args | ||
want error | ||
wantErr bool | ||
}{ | ||
{ | ||
name: "Import missing source type flag", | ||
args: args{"", "file.yaml", "", false}, | ||
want: ErrPatternSourceType(), | ||
wantErr: true, | ||
}, | ||
{ | ||
name: "Import missing file flag", | ||
args: args{"helm", "", "", false}, | ||
want: ErrPatternManifest(), | ||
wantErr: true, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
_, err := importPattern(tt.args.sourceType, tt.args.file, tt.args.patternURL, tt.args.save) | ||
if (err != nil) != tt.wantErr { | ||
t.Errorf("importPattern() error = %v, wantErr %v", err, tt.wantErr) | ||
return | ||
} | ||
}) | ||
} | ||
} |