{"size": 825, "ext": "js", "max_stars_repo_path": "client/src/app/components/home/search-form/search-from.component.spec.js", "max_stars_repo_name": "delete/my-lyrics-finder", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "client/src/app/components/home/search-form/search-from.component.spec.js", "max_issues_repo_name": "delete/my-lyrics-finder", "max_issues_repo_issues_event_min_datetime": "2016-01-31T23:21:20.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-02T04:33:27.000Z", "max_forks_repo_path": "client/src/app/components/home/search-form/search-from.component.spec.js", "max_forks_repo_name": "delete/my-lyrics-finder", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 10, "max_forks_count": null, "avg_line_length": 29.4642857143, "max_line_length": 67, "alphanum_fraction": 0.6109090909}
describe('Component: Search form', () => {
  beforeEach(() => {
    angular.mock.module('components.home.searchForm');
  });

  describe('Controller', () => {
    let $componentController;
    let controller;
    const mockClick = angular.noop;

    beforeEach(inject(($injector) => {
      $componentController = $injector.get('$componentController');
      controller = $componentController('searchForm',
        { $scope: {} },
        { onClick: mockClick}
      );
    }));

    it('should call onClick with the correct payload', () => {
      const mockLyrics = {artist: 'Pearl Jam', music: 'Alive'};
      const payload = { $event: { lyrics: mockLyrics } };

      spyOn(controller, 'onClick');
      controller.clickButton(mockLyrics);
      expect(controller.onClick).toHaveBeenCalledWith(payload);
    });
  });
});