diff --git a/src/screens/Job/JobList/JobList.jsx b/src/screens/Job/JobList/JobList.jsx
index 598546d178..ed581b6057 100644
--- a/src/screens/Job/JobList/JobList.jsx
+++ b/src/screens/Job/JobList/JobList.jsx
@@ -25,7 +25,7 @@ const QS_CONFIG = getQSConfig('job', {
not__launch_type: 'sync',
});
-class JobsList extends Component {
+class JobList extends Component {
constructor (props) {
super(props);
@@ -178,5 +178,5 @@ class JobsList extends Component {
}
}
-export { JobsList as _JobsList };
-export default withI18n()(withRouter(JobsList));
+export { JobList as _JobList };
+export default withI18n()(withRouter(JobList));
diff --git a/src/screens/Job/JobList/JobList.test.jsx b/src/screens/Job/JobList/JobList.test.jsx
new file mode 100644
index 0000000000..dffdf9930b
--- /dev/null
+++ b/src/screens/Job/JobList/JobList.test.jsx
@@ -0,0 +1,83 @@
+import React from 'react';
+import { mountWithContexts, waitForElement } from '@testUtils/enzymeHelpers';
+
+import { UnifiedJobsAPI } from '@api';
+import JobList from './JobList';
+
+jest.mock('@api');
+
+const mockResults = [{
+ id: 1,
+ url: '/api/v2/project_updates/1',
+ name: 'job 1',
+ type: 'project update',
+ summary_fields: {
+ user_capabilities: {
+ delete: true,
+ }
+ }
+}, {
+ id: 2,
+ url: '/api/v2/jobs/2',
+ name: 'job 2',
+ type: 'job',
+ summary_fields: {
+ user_capabilities: {
+ delete: true,
+ }
+ }
+}, {
+ id: 3,
+ url: '/api/v2/jobs/3',
+ name: 'job 3',
+ type: 'job',
+ summary_fields: {
+ user_capabilities: {
+ delete: true,
+ }
+ }
+}];
+
+UnifiedJobsAPI.read.mockResolvedValue({ data: { count: 3, results: mockResults } });
+
+describe('', () => {
+ test('initially renders succesfully', async (done) => {
+ const wrapper = mountWithContexts();
+ await waitForElement(wrapper, 'JobList', (el) => el.state('jobs').length === 3);
+
+ done();
+ });
+
+ test('select makes expected state updates', async (done) => {
+ const [mockItem] = mockResults;
+ const wrapper = mountWithContexts();
+ await waitForElement(wrapper, 'JobListItem', (el) => el.length === 3);
+
+ wrapper.find('JobListItem').first().prop('onSelect')(mockItem);
+ expect(wrapper.find('JobList').state('selected').length).toEqual(1);
+
+ wrapper.find('JobListItem').first().prop('onSelect')(mockItem);
+ expect(wrapper.find('JobList').state('selected').length).toEqual(0);
+
+ done();
+ });
+
+ test('select-all-delete makes expected state updates and api calls', async (done) => {
+ const wrapper = mountWithContexts();
+ await waitForElement(wrapper, 'JobListItem', (el) => el.length === 3);
+
+ wrapper.find('DataListToolbar').prop('onSelectAll')(true);
+ expect(wrapper.find('JobList').state('selected').length).toEqual(3);
+
+ wrapper.find('DataListToolbar').prop('onSelectAll')(false);
+ expect(wrapper.find('JobList').state('selected').length).toEqual(0);
+
+ wrapper.find('DataListToolbar').prop('onSelectAll')(true);
+ expect(wrapper.find('JobList').state('selected').length).toEqual(3);
+
+ wrapper.find('ToolbarDeleteButton').prop('onDelete')();
+ expect(UnifiedJobsAPI.destroy).toHaveBeenCalledTimes(3);
+
+ done();
+ });
+});
diff --git a/src/screens/Job/JobList/JobListItem.test.jsx b/src/screens/Job/JobList/JobListItem.test.jsx
new file mode 100644
index 0000000000..8150d7803c
--- /dev/null
+++ b/src/screens/Job/JobList/JobListItem.test.jsx
@@ -0,0 +1,27 @@
+import React from 'react';
+import { createMemoryHistory } from 'history';
+
+import { mountWithContexts } from '@testUtils/enzymeHelpers';
+
+import JobListItem from './JobListItem';
+
+describe('', () => {
+ test('initially renders succesfully', () => {
+ const history = createMemoryHistory({
+ initialEntries: ['/jobs'],
+ });
+ mountWithContexts(
+ {}}
+ />,
+ { context: { router: { history } } }
+ );
+ });
+});
diff --git a/src/screens/Job/JobList/index.js b/src/screens/Job/JobList/index.js
index cf71a63a21..5b0caebb8a 100644
--- a/src/screens/Job/JobList/index.js
+++ b/src/screens/Job/JobList/index.js
@@ -1,3 +1,2 @@
export { default as JobList } from './JobList';
export { default as JobListItem } from './JobListItem';
-