mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 14:57:39 -02:30
Add Job results skeleton tests
This commit is contained in:
@@ -1,29 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import { mountWithContexts } from '../enzymeHelpers';
|
|
||||||
import Jobs from '../../src/pages/Jobs';
|
|
||||||
|
|
||||||
describe('<Jobs />', () => {
|
|
||||||
let pageWrapper;
|
|
||||||
let pageSections;
|
|
||||||
let title;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
pageWrapper = mountWithContexts(<Jobs />);
|
|
||||||
pageSections = pageWrapper.find('PageSection');
|
|
||||||
title = pageWrapper.find('Title');
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(() => {
|
|
||||||
pageWrapper.unmount();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('initially renders without crashing', () => {
|
|
||||||
expect(pageWrapper.length).toBe(1);
|
|
||||||
expect(pageSections.length).toBe(2);
|
|
||||||
expect(title.length).toBe(1);
|
|
||||||
expect(title.props().size).toBe('2xl');
|
|
||||||
pageSections.forEach(section => {
|
|
||||||
expect(section.props().variant).toBeDefined();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
36
__tests__/pages/Jobs/Jobs.test.jsx
Normal file
36
__tests__/pages/Jobs/Jobs.test.jsx
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { createMemoryHistory } from 'history';
|
||||||
|
import { mountWithContexts } from '../../enzymeHelpers';
|
||||||
|
import Jobs from '../../../src/pages/Jobs';
|
||||||
|
|
||||||
|
describe('<Jobs />', () => {
|
||||||
|
test('initially renders succesfully', () => {
|
||||||
|
mountWithContexts(
|
||||||
|
<Jobs />
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should display correct breadcrumb heading', () => {
|
||||||
|
const history = createMemoryHistory({
|
||||||
|
initialEntries: ['/jobs'],
|
||||||
|
});
|
||||||
|
const match = { path: '/jobs', url: '/jobs', isExact: true };
|
||||||
|
|
||||||
|
const wrapper = mountWithContexts(
|
||||||
|
<Jobs />,
|
||||||
|
{
|
||||||
|
context: {
|
||||||
|
router: {
|
||||||
|
history,
|
||||||
|
route: {
|
||||||
|
location: history.location,
|
||||||
|
match
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
expect(wrapper.find('BreadcrumbHeading').text()).toEqual('Jobs');
|
||||||
|
wrapper.unmount();
|
||||||
|
});
|
||||||
|
});
|
||||||
10
__tests__/pages/Jobs/screens/Job/Job.test.jsx
Normal file
10
__tests__/pages/Jobs/screens/Job/Job.test.jsx
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { mountWithContexts } from '../../../../enzymeHelpers';
|
||||||
|
import Job from '../../../../../src/pages/Jobs/Job';
|
||||||
|
|
||||||
|
|
||||||
|
describe('<Job />', () => {
|
||||||
|
test('initially renders succesfully', () => {
|
||||||
|
mountWithContexts(<Job />);
|
||||||
|
});
|
||||||
|
});
|
||||||
15
__tests__/pages/Jobs/screens/Job/JobDetail.test.jsx
Normal file
15
__tests__/pages/Jobs/screens/Job/JobDetail.test.jsx
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { mountWithContexts } from '../../../../enzymeHelpers';
|
||||||
|
import JobDetail from '../../../../../src/pages/Jobs/JobDetail/';
|
||||||
|
|
||||||
|
describe('<JobDetail />', () => {
|
||||||
|
const mockDetails = {
|
||||||
|
name: 'Foo'
|
||||||
|
};
|
||||||
|
|
||||||
|
test('initially renders succesfully', () => {
|
||||||
|
mountWithContexts(
|
||||||
|
<JobDetail job={ mockDetails } />
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
15
__tests__/pages/Jobs/screens/Job/JobOutput.test.jsx
Normal file
15
__tests__/pages/Jobs/screens/Job/JobOutput.test.jsx
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { mountWithContexts } from '../../../../enzymeHelpers';
|
||||||
|
import JobOutput from '../../../../../src/pages/Jobs/JobOutput/';
|
||||||
|
|
||||||
|
describe('<JobOutput />', () => {
|
||||||
|
const mockDetails = {
|
||||||
|
name: 'Foo'
|
||||||
|
};
|
||||||
|
|
||||||
|
test('initially renders succesfully', () => {
|
||||||
|
mountWithContexts(
|
||||||
|
<JobOutput job={ mockDetails } />
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -64,7 +64,6 @@ export class Job extends Component {
|
|||||||
|
|
||||||
const {
|
const {
|
||||||
job,
|
job,
|
||||||
error,
|
|
||||||
loading
|
loading
|
||||||
} = this.state;
|
} = this.state;
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class Jobs extends Component {
|
|||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
breadcrumbConfig: {
|
breadcrumbConfig: {
|
||||||
'/jobs': i18n._(`Jobs`)
|
'/jobs': i18n._(t`Jobs`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user