import { shallow } from 'enzyme';
import React from 'react';
import assert from 'assert';
import tasks from './';

for (const key in tasks) {
  const TaskComponent = tasks[key];
  describe('Task ' + key, function() {
    let wrapper;

    it('should render with default props', function() {
      wrapper = shallow(<TaskComponent />);
    });

    it('should update on annotation change', function() {
      wrapper = shallow(<TaskComponent />);
      let annotation = TaskComponent.getDefaultAnnotation(tasks[key])
      wrapper.setProps({annotation});
    });
  });
}

import { shallow } from 'enzyme';
import React from 'react';
import assert from 'assert';
import tasks from './';
import { workflow } from '../../pages/dev-classifier/mock-data';

for (const key in workflow.tasks) {
  const task = workflow.tasks[key];
  const TaskComponent = tasks[task.type];
  describe('Task ' + task.type, function() {
    let wrapper;

    it('should render with default props', function() {
      wrapper = shallow(<TaskComponent />);
    });

    it('should update on annotation change', function() {
      wrapper = shallow(<TaskComponent />);
      let annotation = TaskComponent.getDefaultAnnotation(task, workflow, tasks);
      wrapper.setProps({annotation});
    });
  });
}

Use mock task data for generic task tests Update getDefaultAnnotation to use the method signature from the combo task.