refactor and enhance tests for array support