Unit test for array key exists JS