import { UniDriver } from '@wix/wix-ui-test-utils/unidriver';
import { baseUniDriverFactory } from '../../unidriver';
import ErrorCardUniDriver from '../ErrorCard/ErrorCard.uni.driver';
import SkeletonCardUniDriver from '../SkeletonCard/SkeletonCard.uni.driver';

export default (base: UniDriver, body: UniDriver) => {
  const getSkeletonCard = () => SkeletonCardUniDriver(base, body);

  return {
    ...baseUniDriverFactory(base),
    showsSkeletonHeader: () => getSkeletonCard().showsSkeletonHeader(),
    getChildByDataHook: (dataHook: string) =>
      base.$(`[data-hook="${dataHook}"]`),
    getErrorState: () => ErrorCardUniDriver(base, body),
  };
};
