mirror of
https://github.com/ansible/awx.git
synced 2026-01-10 15:32:07 -03:30
Merge pull request #10041 from mabashian/test-warning-cleanup-2
Unit test warning cleanup SUMMARY Cleans up warnings thrown on several unit tests COMPONENT NAME UI Reviewed-by: Kersom <None>
This commit is contained in:
commit
ba7b55bfe3
@ -58,13 +58,13 @@ function JobListCancelButton({ i18n, jobsToCancel, onCancel }) {
|
||||
one="You do not have permission to cancel the following job:"
|
||||
other="You do not have permission to cancel the following jobs:"
|
||||
/>
|
||||
{cannotCancelPermissions.map((job, i) =>
|
||||
i === cannotCancelPermissions.length - 1 ? (
|
||||
<strong> {job}</strong>
|
||||
) : (
|
||||
<strong> {job},</strong>
|
||||
)
|
||||
)}
|
||||
{cannotCancelPermissions.map((job, i) => (
|
||||
<strong key={job}>
|
||||
{' '}
|
||||
{job}
|
||||
{i !== cannotCancelPermissions.length - 1 ? ',' : ''}
|
||||
</strong>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
{cannotCancelNotRunning.length > 0 && (
|
||||
@ -74,13 +74,13 @@ function JobListCancelButton({ i18n, jobsToCancel, onCancel }) {
|
||||
one="You cannot cancel the following job because it is not running:"
|
||||
other="You cannot cancel the following jobs because they are not running:"
|
||||
/>
|
||||
{cannotCancelNotRunning.map((job, i) =>
|
||||
i === cannotCancelNotRunning.length - 1 ? (
|
||||
<strong> {job}</strong>
|
||||
) : (
|
||||
<strong> {job},</strong>
|
||||
)
|
||||
)}
|
||||
{cannotCancelNotRunning.map((job, i) => (
|
||||
<strong key={job}>
|
||||
{' '}
|
||||
{job}
|
||||
{i !== cannotCancelNotRunning.length - 1 ? ',' : ''}
|
||||
</strong>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@ -82,9 +82,9 @@ function ScheduleListItem({
|
||||
{Boolean(isMissingInventory || isMissingSurvey) && (
|
||||
<span>
|
||||
<Tooltip
|
||||
content={[isMissingInventory, isMissingSurvey].map(message => (
|
||||
<div key={message}>{message}</div>
|
||||
))}
|
||||
content={[isMissingInventory, isMissingSurvey].map(message =>
|
||||
message ? <div key={message}>{message}</div> : null
|
||||
)}
|
||||
position="right"
|
||||
>
|
||||
<ExclamationTriangleIcon />
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
import { useHistory, useParams } from 'react-router-dom';
|
||||
import PropTypes from 'prop-types';
|
||||
import { CardBody } from '../../../components/Card';
|
||||
import {
|
||||
CredentialsAPI,
|
||||
@ -14,6 +13,7 @@ import ContentLoading from '../../../components/ContentLoading';
|
||||
import CredentialForm from '../shared/CredentialForm';
|
||||
import useRequest from '../../../util/useRequest';
|
||||
import { useConfig } from '../../../contexts/Config';
|
||||
import { Credential } from '../../../types';
|
||||
|
||||
function CredentialEdit({ credential }) {
|
||||
const history = useHistory();
|
||||
@ -198,7 +198,7 @@ function CredentialEdit({ credential }) {
|
||||
}
|
||||
|
||||
CredentialEdit.propTypes = {
|
||||
credential: PropTypes.objectOf(PropTypes.object).isRequired,
|
||||
credential: Credential.isRequired,
|
||||
};
|
||||
|
||||
export { CredentialEdit as _CredentialEdit };
|
||||
|
||||
@ -120,6 +120,7 @@ function NotificationTemplatesList({ i18n }) {
|
||||
};
|
||||
|
||||
const canAdd = actions && actions.POST;
|
||||
const alertGroupDataCy = 'notification-template-alerts';
|
||||
|
||||
return (
|
||||
<>
|
||||
@ -227,7 +228,7 @@ function NotificationTemplatesList({ i18n }) {
|
||||
{i18n._(t`Failed to delete one or more notification template.`)}
|
||||
<ErrorDetail error={deletionError} />
|
||||
</AlertModal>
|
||||
<AlertGroup ouiaId="notification-template-alerts" isToast>
|
||||
<AlertGroup data-cy={alertGroupDataCy} isToast>
|
||||
{testToasts
|
||||
.filter(notification => notification.status !== 'pending')
|
||||
.map(notification => (
|
||||
|
||||
@ -13,9 +13,18 @@ import {
|
||||
InventoriesAPI,
|
||||
ProjectsAPI,
|
||||
CredentialTypesAPI,
|
||||
ExecutionEnvironmentsAPI,
|
||||
CredentialsAPI,
|
||||
} from '../../../api';
|
||||
|
||||
jest.mock('../../../api');
|
||||
jest.mock('../../../api/models/ExecutionEnvironments');
|
||||
jest.mock('../../../api/models/WorkflowJobTemplates');
|
||||
jest.mock('../../../api/models/Labels');
|
||||
jest.mock('../../../api/models/Organizations');
|
||||
jest.mock('../../../api/models/Inventories');
|
||||
jest.mock('../../../api/models/Projects');
|
||||
jest.mock('../../../api/models/CredentialTypes');
|
||||
jest.mock('../../../api/models/Credentials');
|
||||
|
||||
describe('<WorkflowJobTemplateForm/>', () => {
|
||||
let wrapper;
|
||||
@ -61,7 +70,12 @@ describe('<WorkflowJobTemplateForm/>', () => {
|
||||
},
|
||||
});
|
||||
OrganizationsAPI.read.mockResolvedValue({
|
||||
results: [{ id: 1 }, { id: 2 }],
|
||||
data: {
|
||||
results: [
|
||||
{ id: 1, name: 'Organization 1' },
|
||||
{ id: 2, name: 'Organization 2' },
|
||||
],
|
||||
},
|
||||
});
|
||||
InventoriesAPI.read.mockResolvedValue({
|
||||
results: [
|
||||
@ -78,6 +92,18 @@ describe('<WorkflowJobTemplateForm/>', () => {
|
||||
ProjectsAPI.readOptions.mockResolvedValue({
|
||||
data: { actions: { GET: {}, POST: {} } },
|
||||
});
|
||||
ExecutionEnvironmentsAPI.read.mockResolvedValue({
|
||||
data: { results: [] },
|
||||
});
|
||||
ExecutionEnvironmentsAPI.readOptions.mockResolvedValue({
|
||||
data: { actions: { GET: {}, POST: {} } },
|
||||
});
|
||||
CredentialsAPI.read.mockResolvedValue({
|
||||
data: { results: [] },
|
||||
});
|
||||
CredentialsAPI.readOptions.mockResolvedValue({
|
||||
data: { actions: { GET: {}, POST: {} } },
|
||||
});
|
||||
|
||||
history = createMemoryHistory({
|
||||
initialEntries: ['/templates/workflow_job_template/6/edit'],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user