mirror of
https://github.com/ansible/awx.git
synced 2026-01-14 19:30:39 -03:30
add test for conditional show/hide of schedules tab for project detail view
This commit is contained in:
parent
4db3e823bf
commit
989ef3538e
@ -184,8 +184,6 @@ class Project extends Component {
|
||||
);
|
||||
}
|
||||
|
||||
console.log(project);
|
||||
|
||||
return (
|
||||
<PageSection>
|
||||
<Card>
|
||||
|
||||
@ -68,6 +68,49 @@ describe('<Project />', () => {
|
||||
done();
|
||||
});
|
||||
|
||||
test('schedules tab shown for scm based projects.', async done => {
|
||||
ProjectsAPI.readDetail.mockResolvedValue({ data: mockDetails });
|
||||
OrganizationsAPI.read.mockResolvedValue({
|
||||
count: 0,
|
||||
next: null,
|
||||
previous: null,
|
||||
data: { results: [] },
|
||||
});
|
||||
|
||||
const wrapper = mountWithContexts(
|
||||
<Project setBreadcrumb={() => {}} me={mockMe} />
|
||||
);
|
||||
const tabs = await waitForElement(
|
||||
wrapper,
|
||||
'.pf-c-tabs__item',
|
||||
el => el.length === 4
|
||||
);
|
||||
expect(tabs.at(3).text()).toEqual('Schedules');
|
||||
done();
|
||||
});
|
||||
|
||||
test('schedules tab hidden for manual projects.', async done => {
|
||||
const manualDetails = Object.assign(mockDetails, { scm_type: '' });
|
||||
ProjectsAPI.readDetail.mockResolvedValue({ data: manualDetails });
|
||||
OrganizationsAPI.read.mockResolvedValue({
|
||||
count: 0,
|
||||
next: null,
|
||||
previous: null,
|
||||
data: { results: [] },
|
||||
});
|
||||
|
||||
const wrapper = mountWithContexts(
|
||||
<Project setBreadcrumb={() => {}} me={mockMe} />
|
||||
);
|
||||
const tabs = await waitForElement(
|
||||
wrapper,
|
||||
'.pf-c-tabs__item',
|
||||
el => el.length === 3
|
||||
);
|
||||
tabs.forEach(tab => expect(tab.text()).not.toEqual('Schedules'));
|
||||
done();
|
||||
});
|
||||
|
||||
test('should show content error when user attempts to navigate to erroneous route', async () => {
|
||||
const history = createMemoryHistory({
|
||||
initialEntries: ['/projects/1/foobar'],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user