Skip to content

Commit

Permalink
Add minimal tests to fix coverage error
Browse files Browse the repository at this point in the history
Signed-off-by: mevrin <matthieu.evrin@gmail.com>
  • Loading branch information
lekaf974 committed May 28, 2024
1 parent e43c10e commit 41a1af5
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions mesheryctl/internal/cli/root/pattern/import_test.go
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
}
})
}
}

0 comments on commit 41a1af5

Please sign in to comment.