Add tests for prepare_data