diff --git a/app/static/app/js/components/ProjectList.jsx b/app/static/app/js/components/ProjectList.jsx index da29640e..890b00eb 100644 --- a/app/static/app/js/components/ProjectList.jsx +++ b/app/static/app/js/components/ProjectList.jsx @@ -7,8 +7,13 @@ import Paginated from './Paginated'; import Paginator from './Paginator'; import ErrorMessage from './ErrorMessage'; import { Route } from 'react-router-dom'; +import PropTypes from 'prop-types'; class ProjectList extends Paginated { + static propTypes = { + history: PropTypes.object.isRequired, + } + constructor(props){ super(props); diff --git a/app/static/app/js/components/ProjectListItem.jsx b/app/static/app/js/components/ProjectListItem.jsx index 0ca03732..d0b5fd8e 100644 --- a/app/static/app/js/components/ProjectListItem.jsx +++ b/app/static/app/js/components/ProjectListItem.jsx @@ -9,9 +9,16 @@ import EditProjectDialog from './EditProjectDialog'; import Dropzone from '../vendor/dropzone'; import csrf from '../django/csrf'; import HistoryNav from '../classes/HistoryNav'; +import PropTypes from 'prop-types'; import $ from 'jquery'; class ProjectListItem extends React.Component { + static propTypes = { + history: PropTypes.object.isRequired, + data: PropTypes.object.isRequired, // project json + onDelete: PropTypes.func + } + constructor(props){ super(props); diff --git a/app/static/app/js/components/TaskList.jsx b/app/static/app/js/components/TaskList.jsx index 735df53c..853135c8 100644 --- a/app/static/app/js/components/TaskList.jsx +++ b/app/static/app/js/components/TaskList.jsx @@ -1,8 +1,15 @@ import React from 'react'; import '../css/TaskList.scss'; import TaskListItem from './TaskListItem'; +import PropTypes from 'prop-types'; class TaskList extends React.Component { + static propTypes = { + history: PropTypes.object.isRequired, + source: PropTypes.string.isRequired, // URL where to load task list + onDelete: PropTypes.func + } + constructor(props){ super(props); diff --git a/app/static/app/js/components/TaskListItem.jsx b/app/static/app/js/components/TaskListItem.jsx index 59d5fa41..b6d74dba 100644 --- a/app/static/app/js/components/TaskListItem.jsx +++ b/app/static/app/js/components/TaskListItem.jsx @@ -7,8 +7,16 @@ import ErrorMessage from './ErrorMessage'; import EditTaskPanel from './EditTaskPanel'; import AssetDownloadButtons from './AssetDownloadButtons'; import HistoryNav from '../classes/HistoryNav'; +import PropTypes from 'prop-types'; class TaskListItem extends React.Component { + static propTypes = { + history: PropTypes.object.isRequired, + data: PropTypes.object.isRequired, // task json + refreshInterval: PropTypes.number, // how often to refresh info + onDelete: PropTypes.func + } + constructor(props){ super(); diff --git a/app/static/app/js/components/UploadProgressBar.jsx b/app/static/app/js/components/UploadProgressBar.jsx index f3a21c2e..39d73af0 100644 --- a/app/static/app/js/components/UploadProgressBar.jsx +++ b/app/static/app/js/components/UploadProgressBar.jsx @@ -1,6 +1,13 @@ import React from 'react'; +import PropTypes from 'prop-types'; class UploadProgressBar extends React.Component { + static propTypes = { + progress: PropTypes.number, + totalBytesSent: PropTypes.number, + totalBytes: PropTypes.number, + totalCount: PropTypes.number // number of files + } // http://stackoverflow.com/questions/15900485/correct-way-to-convert-size-in-bytes-to-kb-mb-gb-in-javascript bytesToSize(bytes, decimals = 2){ diff --git a/app/static/app/js/components/tests/EditPresetDialog.test.jsx b/app/static/app/js/components/tests/EditPresetDialog.test.jsx index 99b604b3..a4d639cb 100644 --- a/app/static/app/js/components/tests/EditPresetDialog.test.jsx +++ b/app/static/app/js/components/tests/EditPresetDialog.test.jsx @@ -2,7 +2,7 @@ import React from 'react'; import { shallow } from 'enzyme'; import EditPresetDialog from '../EditPresetDialog'; -let presetMock = require('../../tests/utils/MockLoader').load("preset.json"); +const presetMock = require('../../tests/utils/MockLoader').load("preset.json"); describe('', () => { it('renders without exploding', () => { diff --git a/app/static/app/js/components/tests/EditTaskPanel.test.jsx b/app/static/app/js/components/tests/EditTaskPanel.test.jsx index 24d2e593..2fbd81c8 100644 --- a/app/static/app/js/components/tests/EditTaskPanel.test.jsx +++ b/app/static/app/js/components/tests/EditTaskPanel.test.jsx @@ -2,7 +2,7 @@ import React from 'react'; import { shallow } from 'enzyme'; import EditTaskPanel from '../EditTaskPanel'; -let taskMock = require('../../tests/utils/MockLoader').load("task.json"); +const taskMock = require('../../tests/utils/MockLoader').load("task.json"); describe('', () => { it('renders without exploding', () => { diff --git a/app/static/app/js/components/tests/FormDialog.test.jsx b/app/static/app/js/components/tests/FormDialog.test.jsx index 3a9591f0..68a95be6 100644 --- a/app/static/app/js/components/tests/FormDialog.test.jsx +++ b/app/static/app/js/components/tests/FormDialog.test.jsx @@ -4,7 +4,10 @@ import FormDialog from '../FormDialog'; describe('', () => { it('renders without exploding', () => { - const wrapper = shallow(); + const wrapper = shallow( {}} + reset={() => {}} + saveAction={() => {}} />); expect(wrapper.exists()).toBe(true); }) }); \ No newline at end of file diff --git a/app/static/app/js/components/tests/Map.test.jsx b/app/static/app/js/components/tests/Map.test.jsx new file mode 100644 index 00000000..d0b6807e --- /dev/null +++ b/app/static/app/js/components/tests/Map.test.jsx @@ -0,0 +1,14 @@ +import React from 'react'; +import { shallow } from 'enzyme'; +import Map from '../Map'; + +describe('', () => { + it('renders without exploding', () => { + const wrapper = shallow(); + + // TODO: componentDidUpdate method is never called + + expect(wrapper.exists()).toBe(true); + }) +}); \ No newline at end of file diff --git a/app/static/app/js/components/tests/NewTaskPanel.test.jsx b/app/static/app/js/components/tests/NewTaskPanel.test.jsx new file mode 100644 index 00000000..bbe8d4b0 --- /dev/null +++ b/app/static/app/js/components/tests/NewTaskPanel.test.jsx @@ -0,0 +1,10 @@ +import React from 'react'; +import { shallow } from 'enzyme'; +import NewTaskPanel from '../NewTaskPanel'; + +describe('', () => { + it('renders without exploding', () => { + const wrapper = shallow( {}} />); + expect(wrapper.exists()).toBe(true); + }) +}); \ No newline at end of file diff --git a/app/static/app/js/components/tests/Paginated.test.jsx b/app/static/app/js/components/tests/Paginated.test.jsx new file mode 100644 index 00000000..08e354c8 --- /dev/null +++ b/app/static/app/js/components/tests/Paginated.test.jsx @@ -0,0 +1,16 @@ +import React from 'react'; +import { shallow } from 'enzyme'; +import Paginated from '../Paginated'; + +class MockComponent extends Paginated { + render(){ + return
; + } +} + +describe('', () => { + it('renders without exploding', () => { + const wrapper = shallow(); + expect(wrapper.exists()).toBe(true); + }) +}); \ No newline at end of file diff --git a/app/static/app/js/components/tests/Paginator.test.jsx b/app/static/app/js/components/tests/Paginator.test.jsx new file mode 100644 index 00000000..c66f5c2e --- /dev/null +++ b/app/static/app/js/components/tests/Paginator.test.jsx @@ -0,0 +1,10 @@ +import React from 'react'; +import { shallow } from 'enzyme'; +import Paginator from '../Paginator'; + +describe('', () => { + it('renders without exploding', () => { + const wrapper = shallow(); + expect(wrapper.exists()).toBe(true); + }) +}); \ No newline at end of file diff --git a/app/static/app/js/components/tests/ProcessingNodeOption.test.jsx b/app/static/app/js/components/tests/ProcessingNodeOption.test.jsx new file mode 100644 index 00000000..e7dcb095 --- /dev/null +++ b/app/static/app/js/components/tests/ProcessingNodeOption.test.jsx @@ -0,0 +1,10 @@ +import React from 'react'; +import { shallow } from 'enzyme'; +import ProcessingNodeOption from '../ProcessingNodeOption'; + +describe('', () => { + it('renders without exploding', () => { + const wrapper = shallow(); + expect(wrapper.exists()).toBe(true); + }) +}); \ No newline at end of file diff --git a/app/static/app/js/components/tests/ProjectList.test.jsx b/app/static/app/js/components/tests/ProjectList.test.jsx new file mode 100644 index 00000000..9a3fb6b9 --- /dev/null +++ b/app/static/app/js/components/tests/ProjectList.test.jsx @@ -0,0 +1,10 @@ +import React from 'react'; +import { shallow } from 'enzyme'; +import ProjectList from '../ProjectList'; + +describe('', () => { + it('renders without exploding', () => { + const wrapper = shallow(); + expect(wrapper.exists()).toBe(true); + }) +}); \ No newline at end of file diff --git a/app/static/app/js/components/tests/ProjectListItem.test.jsx b/app/static/app/js/components/tests/ProjectListItem.test.jsx new file mode 100644 index 00000000..dee21d64 --- /dev/null +++ b/app/static/app/js/components/tests/ProjectListItem.test.jsx @@ -0,0 +1,16 @@ +import React from 'react'; +import { shallow } from 'enzyme'; +import ProjectListItem from '../ProjectListItem'; + +const projectMock = require('../../tests/utils/MockLoader').load("project.json"); + +describe('', () => { + it('renders without exploding', () => { + // TODO: load history mock + + const wrapper = shallow(); + expect(wrapper.exists()).toBe(true); + }) +}); \ No newline at end of file diff --git a/app/static/app/js/components/tests/Standby.test.jsx b/app/static/app/js/components/tests/Standby.test.jsx new file mode 100644 index 00000000..e3901794 --- /dev/null +++ b/app/static/app/js/components/tests/Standby.test.jsx @@ -0,0 +1,10 @@ +import React from 'react'; +import { shallow } from 'enzyme'; +import Standby from '../Standby'; + +describe('', () => { + it('renders without exploding', () => { + const wrapper = shallow(); + expect(wrapper.exists()).toBe(true); + }) +}); \ No newline at end of file diff --git a/app/static/app/js/components/tests/SwitchModeButton.test.jsx b/app/static/app/js/components/tests/SwitchModeButton.test.jsx new file mode 100644 index 00000000..d92d29a9 --- /dev/null +++ b/app/static/app/js/components/tests/SwitchModeButton.test.jsx @@ -0,0 +1,10 @@ +import React from 'react'; +import { shallow } from 'enzyme'; +import SwitchModeButton from '../SwitchModeButton'; + +describe('', () => { + it('renders without exploding', () => { + const wrapper = shallow(); + expect(wrapper.exists()).toBe(true); + }) +}); \ No newline at end of file diff --git a/app/static/app/js/components/tests/TaskList.test.jsx b/app/static/app/js/components/tests/TaskList.test.jsx new file mode 100644 index 00000000..a987b3c6 --- /dev/null +++ b/app/static/app/js/components/tests/TaskList.test.jsx @@ -0,0 +1,10 @@ +import React from 'react'; +import { shallow } from 'enzyme'; +import TaskList from '../TaskList'; + +describe('', () => { + it('renders without exploding', () => { + const wrapper = shallow(); + expect(wrapper.exists()).toBe(true); + }) +}); \ No newline at end of file diff --git a/app/static/app/js/components/tests/TaskListItem.test.jsx b/app/static/app/js/components/tests/TaskListItem.test.jsx new file mode 100644 index 00000000..45e90157 --- /dev/null +++ b/app/static/app/js/components/tests/TaskListItem.test.jsx @@ -0,0 +1,13 @@ +import React from 'react'; +import { shallow } from 'enzyme'; +import TaskListItem from '../TaskListItem'; + +const taskMock = require('../../tests/utils/MockLoader').load("task.json"); + +describe('', () => { + it('renders without exploding', () => { + // TODO: load history mock + const wrapper = shallow(); + expect(wrapper.exists()).toBe(true); + }) +}); \ No newline at end of file diff --git a/app/static/app/js/components/tests/UploadProgressBar.test.jsx b/app/static/app/js/components/tests/UploadProgressBar.test.jsx new file mode 100644 index 00000000..6720c45c --- /dev/null +++ b/app/static/app/js/components/tests/UploadProgressBar.test.jsx @@ -0,0 +1,10 @@ +import React from 'react'; +import { shallow } from 'enzyme'; +import UploadProgressBar from '../UploadProgressBar'; + +describe('', () => { + it('renders without exploding', () => { + const wrapper = shallow(); + expect(wrapper.exists()).toBe(true); + }) +}); \ No newline at end of file diff --git a/app/static/app/js/tests/mocks/history.js b/app/static/app/js/tests/mocks/history.js new file mode 100644 index 00000000..dffe7b84 --- /dev/null +++ b/app/static/app/js/tests/mocks/history.js @@ -0,0 +1,3 @@ +// TODO: how? + +export default {}; \ No newline at end of file