Browse Source

SONAR-15309 Change portfolio's empty criteria to match projects'

tags/9.2.0.49834
guillaume-peoch-sonarsource 2 years ago
parent
commit
9004586f55

+ 1
- 1
server/sonar-web/src/main/js/apps/portfolio/components/App.tsx View File

@@ -125,7 +125,7 @@ export class App extends React.PureComponent<Props, State> {
);
}

isEmpty = () => this.state.measures === undefined || this.state.measures['ncloc'] === undefined;
isEmpty = () => this.state.measures === undefined || this.state.measures['lines'] === undefined;

isNotComputed = () =>
this.state.measures && this.state.measures['reliability_rating'] === undefined;

+ 4
- 4
server/sonar-web/src/main/js/apps/portfolio/components/__tests__/App-test.tsx View File

@@ -60,11 +60,11 @@ it('should render correctly', () => {
wrapper.setState({ loading: false, measures: { reliability_rating: '1' } });
expect(wrapper).toMatchSnapshot('portfolio is empty');

wrapper.setState({ measures: { ncloc: '173' } });
wrapper.setState({ measures: { lines: '173' } });
expect(wrapper).toMatchSnapshot('portfolio is not computed');

wrapper.setState({
measures: { ncloc: '173', reliability_rating: '1' },
measures: { lines: '173', reliability_rating: '1' },
subComponents: [],
totalSubComponents: 0
});
@@ -78,7 +78,7 @@ it('should require authentication if this is an unsubscription request and user

it('should show the unsubscribe modal if this is an unsubscription request and user is logged in', async () => {
(getMeasures as jest.Mock).mockResolvedValueOnce([
{ metric: 'ncloc', value: '173' },
{ metric: 'lines', value: '173' },
{ metric: 'reliability_rating', value: '1' }
]);
const wrapper = shallowRender({
@@ -109,7 +109,7 @@ it('fetches measures and children components', () => {
expect(getMeasures).toBeCalledWith({
component: 'foo',
metricKeys:
'projects,ncloc,ncloc_language_distribution,releasability_rating,releasability_effort,sqale_rating,maintainability_rating_effort,reliability_rating,reliability_rating_effort,security_rating,security_rating_effort,security_review_rating,security_review_rating_effort,last_change_on_releasability_rating,last_change_on_maintainability_rating,last_change_on_security_rating,last_change_on_security_review_rating,last_change_on_reliability_rating'
'projects,ncloc,lines,ncloc_language_distribution,releasability_rating,releasability_effort,sqale_rating,maintainability_rating_effort,reliability_rating,reliability_rating_effort,security_rating,security_rating_effort,security_review_rating,security_review_rating_effort,last_change_on_releasability_rating,last_change_on_maintainability_rating,last_change_on_security_rating,last_change_on_security_review_rating,last_change_on_reliability_rating'
});

expect(getChildren).toBeCalledWith(

+ 6
- 6
server/sonar-web/src/main/js/apps/portfolio/components/__tests__/__snapshots__/App-test.tsx.snap View File

@@ -48,7 +48,7 @@ exports[`should render correctly: default 1`] = `
component="foo"
measures={
Object {
"ncloc": "173",
"lines": "173",
"reliability_rating": "1",
}
}
@@ -58,7 +58,7 @@ exports[`should render correctly: default 1`] = `
component="foo"
measures={
Object {
"ncloc": "173",
"lines": "173",
"reliability_rating": "1",
}
}
@@ -68,7 +68,7 @@ exports[`should render correctly: default 1`] = `
component="foo"
measures={
Object {
"ncloc": "173",
"lines": "173",
"reliability_rating": "1",
}
}
@@ -78,7 +78,7 @@ exports[`should render correctly: default 1`] = `
component="foo"
measures={
Object {
"ncloc": "173",
"lines": "173",
"reliability_rating": "1",
}
}
@@ -88,7 +88,7 @@ exports[`should render correctly: default 1`] = `
component="foo"
measures={
Object {
"ncloc": "173",
"lines": "173",
"reliability_rating": "1",
}
}
@@ -143,7 +143,7 @@ exports[`should render correctly: default 1`] = `
<Measure
metricKey="ncloc"
metricType="SHORT_INT"
value="173"
value="0"
/>
</div>
<div

+ 1
- 0
server/sonar-web/src/main/js/apps/portfolio/utils.ts View File

@@ -20,6 +20,7 @@
export const PORTFOLIO_METRICS = [
'projects',
'ncloc',
'lines',
'ncloc_language_distribution',

'releasability_rating',

Loading…
Cancel
Save