55 "encoding/json"
66 "fmt"
77 "net/http"
8+ "strings"
89 "testing"
910
1011 "github.com/spf13/cobra"
@@ -243,6 +244,8 @@ func TestKeyBulkUpdate_InvalidJSON(t *testing.T) {
243244 err := rootCmd .Execute ()
244245 if err == nil {
245246 t .Error ("Expected error for invalid JSON, got nil" )
247+ } else if ! strings .Contains (err .Error (), "invalid character" ) {
248+ t .Errorf ("Expected JSON parse error, got: %v" , err )
246249 }
247250}
248251
@@ -259,6 +262,8 @@ func TestKeyBulkCreate_InvalidJSON(t *testing.T) {
259262 err := rootCmd .Execute ()
260263 if err == nil {
261264 t .Error ("Expected error for invalid JSON, got nil" )
265+ } else if ! strings .Contains (err .Error (), "invalid character" ) {
266+ t .Errorf ("Expected JSON parse error, got: %v" , err )
262267 }
263268}
264269
@@ -275,6 +280,8 @@ func TestKeyBulkUpdate_EmptyKeys(t *testing.T) {
275280 err := rootCmd .Execute ()
276281 if err == nil {
277282 t .Error ("Expected error for empty keys, got nil" )
283+ } else if err .Error () != "--keys must contain at least one key object" {
284+ t .Errorf ("Expected empty keys error, got: %v" , err )
278285 }
279286}
280287
@@ -291,5 +298,8 @@ func TestKeyBulkCreate_EmptyKeys(t *testing.T) {
291298 err := rootCmd .Execute ()
292299 if err == nil {
293300 t .Error ("Expected error for empty keys, got nil" )
301+ } else if err .Error () != "--keys must contain at least one key object" {
302+ t .Errorf ("Expected empty keys error, got: %v" , err )
294303 }
295304}
305+
0 commit comments