diff --git a/pkg/decodeSecret/decodeSecret_test.go b/pkg/decodeSecret/decodeSecret_test.go index ed626e7d..1c62088c 100644 --- a/pkg/decodeSecret/decodeSecret_test.go +++ b/pkg/decodeSecret/decodeSecret_test.go @@ -112,11 +112,12 @@ func TestFormatJson(t *testing.T) { func TestJsonNoDataKey(t *testing.T) { jsn := `{ "key1": "1", "key2": "2" }` sd := secretDecoder{} + expectedMsg := "unable to decode secret, does it have a data key?" _, err := sd.processJson(jsn, false) if err == nil { t.Error("Expected an error when no data key is present") } - if err.Error() != "unable to decode secret, does it have a data key?" { - t.Errorf("Expected error message 'unable to decode secret, does it have a data key?', got '%s'", err.Error()) + if err.Error() != expectedMsg { + t.Errorf("Expected error message '%s', got '%s'", expectedMsg, err.Error()) } }