import { Platform } from 'react-native';
import _ from 'lodash';

const getPlatformTestId = id => {
	const testID = (_.isEmpty(id)) ? '' : id;
	return (
		Platform.OS === 'ios' ? { testID } : { accessible: true, accessibilityLabel: testID }
	);
};

/**
  * Adds a testID to the views on Android and iOS in their specific ways. On Android,
  * this will result in a ContentDescription on Debug builds (and no changes on live builds).
  */
export const setTestID = (id) => getPlatformTestId(id);
