});
it('should display system announcement', async () => {
- (getValues as jest.Mock)
+ jest
+ .mocked(getValues)
.mockResolvedValueOnce([
{
key: 'sonar.announcement.displayMessage',
it('should call metric', async () => {
const metrics = { coverage: mockMetric() };
- (getAllMetrics as jest.Mock).mockResolvedValueOnce(Object.values(metrics));
+ jest.mocked(getAllMetrics).mockResolvedValueOnce(Object.values(metrics));
const wrapper = shallowRender();
expect(getAllMetrics).toHaveBeenCalled();
});
it("should not suggest creating a Project token if the user doesn't have at least one scannable Projects", () => {
- (getScannableProjects as jest.Mock).mockResolvedValueOnce({
+ jest.mocked(getScannableProjects).mockResolvedValueOnce({
projects: [],
});
renderAccountApp(
});
it('should preselect the user token type if the user has no scan rights', async () => {
- (getScannableProjects as jest.Mock).mockResolvedValueOnce({
+ jest.mocked(getScannableProjects).mockResolvedValueOnce({
projects: [],
});
renderAccountApp(mockLoggedInUser(), securityPagePath);
});
it('should preselect the only project the user has access to if they select project token', async () => {
- (getScannableProjects as jest.Mock).mockResolvedValueOnce({
+ jest.mocked(getScannableProjects).mockResolvedValueOnce({
projects: [
{
key: 'project-key-1',
branchLike={branchLike}
branchLikes={branchLikes}
component={component}
- hasAnalyses={isPending || isInProgress}
+ hasAnalyses={isPending ?? isInProgress}
projectBinding={projectBinding}
/>
)}
}
function metricKeyExists(key: string, metrics: Dict<Metric>) {
- return metrics && metrics[key] !== undefined;
+ return metrics[key] !== undefined;
}
function getNoDiffMetric(metric: Metric, metrics: Dict<Metric>) {
</td>
<td className="thin nowrap text-middle">
<UserGroups
- groups={user.groups || []}
+ groups={user.groups ?? []}
manageProvider={manageProvider}
onUpdateUsers={onUpdateUsers}
user={user}
return (
<div className="big-spacer-right">
<ButtonToggle
- value={managed === undefined ? 'all' : managed}
+ value={managed ?? 'all'}
disabled={loading}
options={[
{ label: translate('all'), value: 'all' },
const query = new URLSearchParams(this.props.location.search);
if (query.has('why')) {
this.setState({
- selectedTab: tabs.find((tab) => tab.key === TabKeys.WhyIsThisAnIssue) || tabs[0],
+ selectedTab: tabs.find((tab) => tab.key === TabKeys.WhyIsThisAnIssue) ?? tabs[0],
});
}
}