diff --git a/tests/lib.sh b/tests/lib.sh
index ad7c12cb0..81bc1439c 100644
--- a/tests/lib.sh
+++ b/tests/lib.sh
@@ -38,7 +38,8 @@ test_that_key_in_arry_has_value() {
 		return 1
 	fi
 
-	if [[ ! -v "${array[${key}]}" ]]; then
+
+	if [[ "${array["${key}"]+_}" == ""  ]]; then
 		log_test_failed "The array does not contain the key '${key}', valid keys are: ${!array[*]}"
 		return 1
 	fi
