adding array data to unit tests and fix a bug in conditional check for key