diff --git a/tests/lib.sh b/tests/lib.sh
index 7749d5158..c51257e79 100644
--- a/tests/lib.sh
+++ b/tests/lib.sh
@@ -18,3 +18,17 @@ test_that() {
 var_has_value() {
 	[[ "${!1}" == "${2}" ]]
 }
+
+test_that_key_in_arry_has_value() {
+	local array="${!1}"
+	local key="${2}"
+	local value="${3}"
+
+	if [[ "${array[${key}]}" == "${value}" ]] ; then
+		echo -e "${CLR_GREEN_BG}Test succeded: The array '${1}' contains the value '${value}' under the key '${key}' ${CLR_RESET}"
+		return 0
+	else
+		echo -e "${CLR_RED_BG}Test failed: The array '${1}' contains the value '${array[${key}]}' under the key '${key} and not '${value}' ${CLR_RESET}"
+		return 1
+	fi
+}
