Skip to content

Commit 387f597

Browse files
manzil-infinity180jkjell
authored andcommitted
test: add unit test for unsupported --format value
Signed-off-by: Rahul Vishwakarma <rahulvs2809@gmail.com>
1 parent 817b25c commit 387f597

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

cmd/archivistactl/cmd/search_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,19 @@ func (ut *UTSearchSuite) Test_SearchInvalidDigestString() {
5656
}
5757
}
5858

59+
func (ut *UTSearchSuite) Test_SearchInvalidFormat() {
60+
output := bytes.NewBufferString("")
61+
rootCmd.SetOut(output)
62+
rootCmd.SetErr(output)
63+
rootCmd.SetArgs([]string{"search", "sha256:test", "--format", "yaml"})
64+
err := rootCmd.Execute()
65+
if err != nil {
66+
ut.ErrorContains(err, "unsupported format")
67+
} else {
68+
ut.FailNow("Expected: error")
69+
}
70+
}
71+
5972
func (ut *UTSearchSuite) Test_NoDB() {
6073
output := bytes.NewBufferString("")
6174
rootCmd.SetOut(output)

0 commit comments

Comments
 (0)