Add test for to_hash