mirror of
https://github.com/ansible/awx.git
synced 2026-03-13 23:17:32 -02:30
Add unit tests that check activity stream is hidden appropriately
This commit is contained in:
@@ -76,6 +76,7 @@ describe('<HostDetail />', () => {
|
||||
beforeAll(() => {
|
||||
const readOnlyHost = { ...mockHost };
|
||||
readOnlyHost.summary_fields.user_capabilities.edit = false;
|
||||
readOnlyHost.summary_fields.recent_jobs = [];
|
||||
|
||||
wrapper = mountWithContexts(<HostDetail host={mockHost} />);
|
||||
});
|
||||
@@ -84,6 +85,12 @@ describe('<HostDetail />', () => {
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
test('should hide activity stream when there are no recent jobs', async () => {
|
||||
expect(wrapper.find(`Detail[label="Activity"] Sparkline`)).toHaveLength(
|
||||
0
|
||||
);
|
||||
});
|
||||
|
||||
test('should hide edit button for users without edit permission', async () => {
|
||||
expect(wrapper.find('Button[aria-label="edit"]').length).toBe(0);
|
||||
});
|
||||
|
||||
@@ -50,7 +50,7 @@ function Inventories({ i18n }) {
|
||||
[`${inventoryHostsPath}/${nested?.id}`]: `${nested?.name}`,
|
||||
[`${inventoryHostsPath}/${nested?.id}/edit`]: i18n._(t`Edit details`),
|
||||
[`${inventoryHostsPath}/${nested?.id}/details`]: i18n._(
|
||||
t`Host Details`
|
||||
t`Host details`
|
||||
),
|
||||
[`${inventoryHostsPath}/${nested?.id}/completed_jobs`]: i18n._(
|
||||
t`Completed jobs`
|
||||
@@ -80,7 +80,7 @@ function Inventories({ i18n }) {
|
||||
),
|
||||
[`${inventorySourcesPath}/${nested?.id}/schedules/${schedule?.id}`]: `${schedule?.name}`,
|
||||
[`${inventorySourcesPath}/${nested?.id}/schedules/${schedule?.id}/details`]: i18n._(
|
||||
t`Schedule Details`
|
||||
t`Schedule details`
|
||||
),
|
||||
});
|
||||
},
|
||||
|
||||
@@ -79,6 +79,7 @@ describe('<InventoryHostDetail />', () => {
|
||||
beforeAll(() => {
|
||||
const readOnlyHost = { ...mockHost };
|
||||
readOnlyHost.summary_fields.user_capabilities.edit = false;
|
||||
readOnlyHost.summary_fields.recent_jobs = [];
|
||||
|
||||
wrapper = mountWithContexts(<InventoryHostDetail host={mockHost} />);
|
||||
});
|
||||
@@ -87,6 +88,12 @@ describe('<InventoryHostDetail />', () => {
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
test('should hide activity stream when there are no recent jobs', async () => {
|
||||
expect(wrapper.find(`Detail[label="Activity"] Sparkline`)).toHaveLength(
|
||||
0
|
||||
);
|
||||
});
|
||||
|
||||
test('should hide edit button for users without edit permission', async () => {
|
||||
expect(wrapper.find('Button[aria-label="edit"]').length).toBe(0);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user