import DeleteCredentialModal from '@components/DeleteCredentialModal';
import React from 'react';
import {shallow} from 'enzyme';
import renderer from 'react-test-renderer';

test('renders correctly DeleteCredential', () => {
  const tree = renderer
    .create(
      <DeleteCredentialModal
        onHide={function (): void {
          throw new Error('Function not implemented.');
        }}
        credentials={[]}
      />,
    )
    .toJSON();
  expect(tree).toMatchSnapshot();
});

test('check if YES field render properly', () => {
  const wrapper = shallow(
    <DeleteCredentialModal onHide={jest.fn()} credentials={[]} />,
  );
  expect(wrapper.find({testID: 'yesDlt'})).toBeDefined();
});

test('check if Yes onPress works properly', () => {
  const wrapper = shallow(
    <DeleteCredentialModal onHide={jest.fn()} credentials={[]} />,
  );
  let value = wrapper.find({testID: 'yesDlt'});
  value.simulate('press');
  expect(value.simulate('press')).toBeTruthy();
});

test('check if No field render properly', () => {
  const wrapper = shallow(
    <DeleteCredentialModal onHide={jest.fn()} credentials={[]} />,
  );
  expect(wrapper.find({testID: 'noDlt'})).toBeDefined();
});

test('check if No onPress works properly', () => {
  const wrapper = shallow(
    <DeleteCredentialModal onHide={jest.fn()} credentials={[]} />,
  );
  let value = wrapper.find({testID: 'noDlt'});
  value.simulate('press');
  expect(value.simulate('press')).toBeTruthy();
});
