@@ -36,7 +36,8 @@ jest.mock('lodash', () => { | |||
}); | |||
it('should display system announcement', async () => { | |||
(getValues as jest.Mock) | |||
jest | |||
.mocked(getValues) | |||
.mockResolvedValueOnce([ | |||
{ | |||
key: 'sonar.announcement.displayMessage', |
@@ -30,7 +30,7 @@ jest.mock('../../../../api/metrics', () => ({ | |||
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(); |
@@ -389,7 +389,7 @@ describe('security page', () => { | |||
}); | |||
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( | |||
@@ -402,7 +402,7 @@ describe('security page', () => { | |||
}); | |||
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); | |||
@@ -412,7 +412,7 @@ describe('security page', () => { | |||
}); | |||
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', |
@@ -69,7 +69,7 @@ export function App(props: AppProps) { | |||
branchLike={branchLike} | |||
branchLikes={branchLikes} | |||
component={component} | |||
hasAnalyses={isPending || isInProgress} | |||
hasAnalyses={isPending ?? isInProgress} | |||
projectBinding={projectBinding} | |||
/> | |||
)} |
@@ -243,7 +243,7 @@ export function getPossibleOperators(metric: Metric) { | |||
} | |||
function metricKeyExists(key: string, metrics: Dict<Metric>) { | |||
return metrics && metrics[key] !== undefined; | |||
return metrics[key] !== undefined; | |||
} | |||
function getNoDiffMetric(metric: Metric, metrics: Dict<Metric>) { |
@@ -80,7 +80,7 @@ export default function UserListItem(props: UserListItemProps) { | |||
</td> | |||
<td className="thin nowrap text-middle"> | |||
<UserGroups | |||
groups={user.groups || []} | |||
groups={user.groups ?? []} | |||
manageProvider={manageProvider} | |||
onUpdateUsers={onUpdateUsers} | |||
user={user} |
@@ -38,7 +38,7 @@ export function ManagedFilter(props: ManagedFilterProps) { | |||
return ( | |||
<div className="big-spacer-right"> | |||
<ButtonToggle | |||
value={managed === undefined ? 'all' : managed} | |||
value={managed ?? 'all'} | |||
disabled={loading} | |||
options={[ | |||
{ label: translate('all'), value: 'all' }, |
@@ -98,7 +98,7 @@ export class RuleTabViewer extends React.PureComponent<RuleTabViewerProps, State | |||
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], | |||
}); | |||
} | |||
} |