{"size": 1446, "ext": "js", "max_stars_repo_path": "05.photo-album-finalversion/src/components/Photo/PhotoForm.test.js", "max_stars_repo_name": "agzertuche/Intro-to-React", "max_stars_repo_stars_event_min_datetime": "2017-11-18T15:51:10.000Z", "max_stars_repo_stars_event_max_datetime": "2018-01-26T03:33:20.000Z", "max_issues_repo_path": "05.photo-album-finalversion/src/components/Photo/PhotoForm.test.js", "max_issues_repo_name": "agzertuche/Intro-to-React", "max_issues_repo_issues_event_min_datetime": "2019-07-20T14:28:28.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-10T13:33:37.000Z", "max_forks_repo_path": "05.photo-album-finalversion/src/components/Photo/PhotoForm.test.js", "max_forks_repo_name": "agzertuche/Intro-to-React", "max_forks_repo_forks_event_min_datetime": "2017-11-16T21:49:50.000Z", "max_forks_repo_forks_event_max_datetime": "2021-04-05T08:59:39.000Z"}
{"max_stars_count": 2, "max_issues_count": 5, "max_forks_count": 11, "avg_line_length": 27.2830188679, "max_line_length": 75, "alphanum_fraction": 0.5871369295}
/* global describe, it, expect, shallow, jest */
import React from 'react';
import { PhotoForm } from './PhotoForm';
import { Button } from 'semantic-ui-react'

const setup = ( formType ) => {
  const props = {
    formType,
    key: 'photo1',
    photo: { 
      "title": "Fright Night Part II",
      "description": "Nunc rhoncus dui vel sem.",
      "url": "https://source.unsplash.com/1600x900/?happy"
    },
    updatePhoto: jest.fn(),
    createPhoto: jest.fn(),
  }

  const component = shallow(<PhotoForm {...props} />); 

  return {
    component,
    props,
    modalButton: component.find(Button).first(),
    saveButton: component.find(Button).last(),
  }
}

describe('PhotoForm', () => {

  describe('New Form', () => {
    const { component } = setup('New');
    it('should render without crash', () => {
      expect(component);
    });
  });

  // describe('Edit Form', () => {
  //   const { component, props, modalButton, saveButton } = setup('Edit');
  //   // modalButton.simulate('click');
  //   // const inputTitle = component.find(Form.Input).first();
  //   // console.log(inputTitle.render(), inputTitle.props());
  //   // it('should render all properties of photo', () => {
  //   //   expect(inputTitle.text()).toEqual(props.photo.title);
  //   // });

  //   console.log(modalButton);
  //   console.log(saveButton);
  //   saveButton.simulate('click');
  //   expect(props.updatePhoto).toBeCalled()
  // });
  
});