const { weakConditions, missingConditions } = getWeakMissingAndNonCaycConditions(conditions);
const sortedWeakConditions = sortBy(
weakConditions,
- (condition) => metrics[condition.metric] && metrics[condition.metric].name
+ (condition) => metrics[condition.metric] && metrics[condition.metric].name,
);
const sortedMissingConditions = sortBy(
missingConditions,
- (condition) => metrics[condition.metric] && metrics[condition.metric].name
+ (condition) => metrics[condition.metric] && metrics[condition.metric].name,
);
const getDocUrl = useDocUrl();
onSaveCondition(resultCondition, currentCondition);
}
})
- .catch(() => undefined)
+ .catch(() => undefined),
);
});
gateName: qualityGate.name,
})
.then((resultCondition) => onAddCondition(resultCondition))
- .catch(() => undefined)
+ .catch(() => undefined),
);
});
<Title as="h4" className="sw-mb-2 sw-mt-4 sw-body-sm-highlight">
{translateWithParameters(
'quality_gates.cayc.review_update_modal.add_condition.header',
- sortedMissingConditions.length
+ sortedMissingConditions.length,
)}
</Title>
<ConditionsTable
<Title as="h4" className="sw-mb-2 sw-mt-4 sw-body-sm-highlight">
{translateWithParameters(
'quality_gates.cayc.review_update_modal.modify_condition.header',
- sortedWeakConditions.length
+ sortedWeakConditions.length,
)}
</Title>
<ConditionsTable
isLarge
headerTitle={translateWithParameters(
'quality_gates.cayc.review_update_modal.header',
- qualityGate.name
+ qualityGate.name,
)}
onClose={onClose}
body={body}
updatedConditionId,
}: Props) {
const [editing, setEditing] = React.useState<boolean>(
- qualityGate.caycStatus === CaycStatus.NonCompliant
+ qualityGate.caycStatus === CaycStatus.NonCompliant,
);
const canEdit = Boolean(qualityGate.actions?.manageConditions);
const { conditions = [] } = qualityGate;
const existingConditions = conditions.filter((condition) => metrics[condition.metric]);
const { overallCodeConditions, newCodeConditions } = groupAndSortByPriorityConditions(
existingConditions,
- metrics
+ metrics,
);
const duplicates: ConditionType[] = [];
(metric) =>
!metric.hidden &&
!FORBIDDEN_METRIC_TYPES.includes(metric.type) &&
- !FORBIDDEN_METRICS.includes(metric.key)
+ !FORBIDDEN_METRICS.includes(metric.key),
),
conditions,
- (metric, condition) => metric.key === condition.metric
+ (metric, condition) => metric.key === condition.metric,
);
return (
<ConditionModal
/>
);
},
- [metrics, qualityGate, onAddCondition]
+ [metrics, qualityGate, onAddCondition],
);
const renderCaycModal = React.useCallback(
/>
);
},
- [qualityGate, metrics, updatedConditionId, onAddCondition, onRemoveCondition, onSaveCondition]
+ [qualityGate, metrics, updatedConditionId, onAddCondition, onRemoveCondition, onSaveCondition],
);
return (
await screen.findByRole('button', {
current: 'page',
name: `${defaultQualityGate.name} default`,
- })
+ }),
).toBeInTheDocument();
});
expect(
await screen.findByRole('button', {
name: `${handler.getDefaultQualityGate().name} default`,
- })
+ }),
).toBeInTheDocument();
expect(
screen.getByRole('button', {
name: `${handler.getBuiltInQualityGate().name} quality_gates.built_in`,
- })
+ }),
).toBeInTheDocument();
});
await user.click(dialog.getByRole('button', { name: 'quality_gates.add_condition' }));
expect(
- await overallConditions.findByRole('cell', { name: 'Maintainability Rating' })
+ await overallConditions.findByRole('cell', { name: 'Maintainability Rating' }),
).toBeInTheDocument();
expect(await overallConditions.findByRole('cell', { name: 'B' })).toBeInTheDocument();
});
const newConditions = within(await screen.findByTestId('quality-gates__conditions-new'));
await user.click(
- newConditions.getByLabelText('quality_gates.condition.edit.Coverage on New Code')
+ newConditions.getByLabelText('quality_gates.condition.edit.Coverage on New Code'),
);
const dialog = within(screen.getByRole('dialog'));
await user.click(dialog.getByRole('textbox', { name: 'quality_gates.conditions.value' }));
await user.click(
// make it a regexp to ignore badges:
- await screen.findByRole('button', { name: new RegExp(handler.getCorruptedQualityGateName()) })
+ await screen.findByRole('button', { name: new RegExp(handler.getCorruptedQualityGateName()) }),
);
expect(await screen.findByText('quality_gates.duplicated_conditions')).toBeInTheDocument();
expect(
- await screen.findByRole('cell', { name: 'Complexity / Function deprecated' })
+ await screen.findByRole('cell', { name: 'Complexity / Function deprecated' }),
).toBeInTheDocument();
});
const newConditions = within(await screen.findByTestId('quality-gates__conditions-new'));
await user.click(
- newConditions.getByLabelText('quality_gates.condition.delete.Coverage on New Code')
+ newConditions.getByLabelText('quality_gates.condition.delete.Coverage on New Code'),
);
const dialog = within(screen.getByRole('dialog'));
renderQualityGateApp({ featureList: [Feature.BranchSupport] });
expect(
- await screen.findByText('quality_gates.conditions.new_code.description')
+ await screen.findByText('quality_gates.conditions.new_code.description'),
).toBeInTheDocument();
expect(
- await screen.findByText('quality_gates.conditions.overall_code.description')
+ await screen.findByText('quality_gates.conditions.overall_code.description'),
).toBeInTheDocument();
});
expect(screen.getByText('quality_gates.cayc_missing.banner.title')).toBeInTheDocument();
expect(screen.getByText('quality_gates.cayc_missing.banner.description')).toBeInTheDocument();
expect(
- screen.getByRole('button', { name: 'quality_gates.cayc_condition.review_update' })
+ screen.getByRole('button', { name: 'quality_gates.cayc_condition.review_update' }),
).toBeInTheDocument();
await user.click(
- screen.getByRole('button', { name: 'quality_gates.cayc_condition.review_update' })
+ screen.getByRole('button', { name: 'quality_gates.cayc_condition.review_update' }),
);
expect(
screen.getByRole('dialog', {
name: 'quality_gates.cayc.review_update_modal.header.SonarSource way - CFamily',
- })
+ }),
).toBeInTheDocument();
expect(
- screen.getByText('quality_gates.cayc.review_update_modal.description1')
+ screen.getByText('quality_gates.cayc.review_update_modal.description1'),
).toBeInTheDocument();
expect(
- screen.getByText('quality_gates.cayc.review_update_modal.description2')
+ screen.getByText('quality_gates.cayc.review_update_modal.description2'),
).toBeInTheDocument();
expect(
- screen.getByRole('button', { name: 'quality_gates.cayc.review_update_modal.confirm_text' })
+ screen.getByRole('button', { name: 'quality_gates.cayc.review_update_modal.confirm_text' }),
).toBeInTheDocument();
await user.click(
- screen.getByRole('button', { name: 'quality_gates.cayc.review_update_modal.confirm_text' })
+ screen.getByRole('button', { name: 'quality_gates.cayc.review_update_modal.confirm_text' }),
);
const conditionsWrapper = within(await screen.findByTestId('quality-gates__conditions-new'));
expect(conditionsWrapper.getByText('Duplicated Lines (%)')).toBeInTheDocument();
const overallConditionsWrapper = within(
- await screen.findByTestId('quality-gates__conditions-overall')
+ await screen.findByTestId('quality-gates__conditions-overall'),
);
expect(overallConditionsWrapper.getByText('Complexity / Function')).toBeInTheDocument();
});
expect(screen.getByText('quality_gates.cayc.banner.title')).toBeInTheDocument();
expect(
- screen.getByText('quality_gates.cayc.banner.description1', { exact: false })
+ screen.getByText('quality_gates.cayc.banner.description1', { exact: false }),
).toBeInTheDocument();
expect(
- screen.queryByText('quality_gates.cayc_condition.missing_warning.title')
+ screen.queryByText('quality_gates.cayc_condition.missing_warning.title'),
).not.toBeInTheDocument();
expect(
- screen.queryByRole('button', { name: 'quality_gates.cayc_condition.review_update' })
+ screen.queryByRole('button', { name: 'quality_gates.cayc_condition.review_update' }),
).not.toBeInTheDocument();
const conditionsWrapper = within(await screen.findByTestId('quality-gates__conditions-new'));
expect(
screen.queryByRole('button', {
name: 'quality_gates.condition.edit.Security Rating on New Code',
- })
+ }),
).not.toBeInTheDocument();
expect(
screen.queryByRole('button', {
name: 'quality_gates.condition.delete.Security Rating on New Code',
- })
+ }),
).not.toBeInTheDocument();
await user.click(screen.getByText('quality_gates.cayc.unlock_edit'));
expect(
screen.getByRole('button', {
name: 'quality_gates.condition.edit.Security Rating on New Code',
- })
+ }),
).toBeInTheDocument();
expect(
screen.getByRole('button', {
name: 'quality_gates.condition.delete.Security Rating on New Code',
- })
+ }),
).toBeInTheDocument();
});
expect(
await screen.findByRole('button', {
name: `${handler.getDefaultQualityGate().name} default`,
- })
+ }),
).toBeInTheDocument();
expect(screen.queryByText('quality_gates.permissions')).not.toBeInTheDocument();