Fix Each child in a list should have a unique "key" prop warnings in unit tests

This commit is contained in:
mabashian 2021-04-27 16:09:43 -04:00
parent 24a903142a
commit 61f0edc5e8
2 changed files with 17 additions and 17 deletions

View File

@ -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>

View File

@ -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 />