diff options
author | Stas Vilchik <stas.vilchik@sonarsource.com> | 2018-12-05 17:30:59 +0100 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2018-12-07 20:21:04 +0100 |
commit | 6c670cd326f0e1d853cdf3790b746f5b836c12ea (patch) | |
tree | e9e6eb8df93b0128373497db60c86a49ed9b80ac /server/sonar-web/src/main/js | |
parent | f316b94c37e917de6f94062967c540adfd87c886 (diff) | |
download | sonarqube-6c670cd326f0e1d853cdf3790b746f5b836c12ea.tar.gz sonarqube-6c670cd326f0e1d853cdf3790b746f5b836c12ea.zip |
SONAR-11489 drop listing of files covered by a tests
Diffstat (limited to 'server/sonar-web/src/main/js')
12 files changed, 1 insertions, 948 deletions
diff --git a/server/sonar-web/src/main/js/api/tests.ts b/server/sonar-web/src/main/js/api/tests.ts deleted file mode 100644 index 7dbb75c19af..00000000000 --- a/server/sonar-web/src/main/js/api/tests.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import throwGlobalError from '../app/utils/throwGlobalError'; -import { getJSON } from '../helpers/request'; - -export function getTests( - parameters: { - p?: number; - ps?: number; - sourceFileKey?: string; - sourceFileLineNumber?: number; - testFileKey: string; - testId?: string; - } & T.BranchParameters -): Promise<{ paging: T.Paging; tests: T.TestCase[] }> { - return getJSON('/api/tests/list', parameters).catch(throwGlobalError); -} - -export function getCoveredFiles(data: { testId: string }): Promise<T.CoveredFile[]> { - return getJSON('/api/tests/covered_files', data).then(r => r.files, throwGlobalError); -} diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlay.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlay.tsx index 14fd268ddf3..3a56a217471 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlay.tsx +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlay.tsx @@ -21,7 +21,6 @@ import * as React from 'react'; import { Link } from 'react-router'; import { keyBy, sortBy, groupBy } from 'lodash'; import MeasuresOverlayMeasure from './MeasuresOverlayMeasure'; -import MeasuresOverlayTestCases from './MeasuresOverlayTestCases'; import { Button } from '../../ui/buttons'; import { getFacets } from '../../../api/issues'; import { getMeasures } from '../../../api/measures'; @@ -419,13 +418,7 @@ export default class MeasuresOverlay extends React.PureComponent<Props, State> { ) : ( <> {sourceViewerFile.q === 'UTS' ? ( - <> - {this.renderTests()} - <MeasuresOverlayTestCases - branchLike={branchLike} - componentKey={sourceViewerFile.key} - /> - </> + this.renderTests() ) : ( <div className="source-viewer-measures"> {this.renderLines()} diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlayCoveredFiles.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlayCoveredFiles.tsx deleted file mode 100644 index 530acbcdab3..00000000000 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlayCoveredFiles.tsx +++ /dev/null @@ -1,114 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import * as React from 'react'; -import { Link } from 'react-router'; -import { getCoveredFiles } from '../../../api/tests'; -import { translate, translateWithParameters } from '../../../helpers/l10n'; -import { getProjectUrl } from '../../../helpers/urls'; -import DeferredSpinner from '../../common/DeferredSpinner'; - -interface Props { - testCase: T.TestCase; -} - -interface State { - coveredFiles?: T.CoveredFile[]; - loading: boolean; -} - -export default class MeasuresOverlayCoveredFiles extends React.PureComponent<Props, State> { - mounted = false; - state: State = { loading: true }; - - componentDidMount() { - this.mounted = true; - this.fetchCoveredFiles(); - } - - componentDidUpdate(prevProps: Props) { - if (this.props.testCase.id !== prevProps.testCase.id) { - this.fetchCoveredFiles(); - } - } - - componentWillUnmount() { - this.mounted = false; - } - - fetchCoveredFiles = () => { - this.setState({ loading: true }); - getCoveredFiles({ testId: this.props.testCase.id }).then( - coveredFiles => { - if (this.mounted) { - this.setState({ coveredFiles, loading: false }); - } - }, - () => { - if (this.mounted) { - this.setState({ loading: false }); - } - } - ); - }; - - render() { - const { testCase } = this.props; - const { loading, coveredFiles } = this.state; - - return ( - <div className="source-viewer-measures-section source-viewer-measures-section-big js-selected-test"> - <DeferredSpinner loading={loading}> - <div className="source-viewer-measures-card source-viewer-measures-card-fixed-height"> - {testCase.status !== 'ERROR' && - testCase.status !== 'FAILURE' && - coveredFiles !== undefined && ( - <> - <h6 className="spacer-bottom"> - {translate('component_viewer.transition.covers')} - </h6> - {coveredFiles.length > 0 - ? coveredFiles.map(coveredFile => ( - <div className="spacer-top" key={coveredFile.key}> - <Link to={getProjectUrl(coveredFile.key)}>{coveredFile.longName}</Link> - <span className="note spacer-left"> - {translateWithParameters( - 'component_viewer.x_lines_are_covered', - coveredFile.coveredLines - )} - </span> - </div> - )) - : translate('none')} - </> - )} - - {testCase.status !== 'OK' && ( - <> - <h6 className="spacer-bottom">{translate('component_viewer.details')}</h6> - {testCase.message && <pre>{testCase.message}</pre>} - <pre>{testCase.stacktrace}</pre> - </> - )} - </div> - </DeferredSpinner> - </div> - ); - } -} diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlayTestCase.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlayTestCase.tsx deleted file mode 100644 index 2f149fd4471..00000000000 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlayTestCase.tsx +++ /dev/null @@ -1,61 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import * as React from 'react'; -import TestStatusIcon from '../../icons-components/TestStatusIcon'; - -interface Props { - onClick: (testId: string) => void; - testCase: T.TestCase; -} - -export default class MeasuresOverlayTestCase extends React.PureComponent<Props> { - handleTestCaseClick = (event: React.SyntheticEvent<HTMLAnchorElement>) => { - event.preventDefault(); - event.currentTarget.blur(); - this.props.onClick(this.props.testCase.id); - }; - - render() { - const { testCase } = this.props; - const { status } = testCase; - const hasAdditionalData = status !== 'OK' || (status === 'OK' && testCase.coveredLines); - - return ( - <tr> - <td className="source-viewer-test-status"> - <TestStatusIcon status={status} /> - </td> - <td className="source-viewer-test-duration note"> - {status !== 'SKIPPED' && `${testCase.durationInMs}ms`} - </td> - <td className="source-viewer-test-name"> - {hasAdditionalData ? ( - <a className="js-show-test" href="#" onClick={this.handleTestCaseClick}> - {testCase.name} - </a> - ) : ( - testCase.name - )} - </td> - <td className="source-viewer-test-covered-lines note">{testCase.coveredLines}</td> - </tr> - ); - } -} diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlayTestCases.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlayTestCases.tsx deleted file mode 100644 index 244bd4b6a26..00000000000 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/MeasuresOverlayTestCases.tsx +++ /dev/null @@ -1,185 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import * as React from 'react'; -import * as classNames from 'classnames'; -import { orderBy } from 'lodash'; -import MeasuresOverlayCoveredFiles from './MeasuresOverlayCoveredFiles'; -import MeasuresOverlayTestCase from './MeasuresOverlayTestCase'; -import { getTests } from '../../../api/tests'; -import { translate } from '../../../helpers/l10n'; -import { getBranchLikeQuery } from '../../../helpers/branches'; - -interface Props { - branchLike: T.BranchLike | undefined; - componentKey: string; -} - -interface State { - loading: boolean; - selectedTestId?: string; - sort?: string; - sortAsc?: boolean; - testCases?: T.TestCase[]; -} - -export default class MeasuresOverlayTestCases extends React.PureComponent<Props, State> { - mounted = false; - state: State = { loading: true }; - - componentDidMount() { - this.mounted = true; - this.fetchTests(); - } - - componentDidUpdate(prevProps: Props) { - if ( - prevProps.branchLike !== this.props.branchLike || - prevProps.componentKey !== this.props.componentKey - ) { - this.fetchTests(); - } - } - - componentWillUnmount() { - this.mounted = false; - } - - fetchTests = () => { - // TODO implement pagination one day... - this.setState({ loading: true }); - getTests({ - ps: 500, - testFileKey: this.props.componentKey, - ...getBranchLikeQuery(this.props.branchLike) - }).then( - ({ tests: testCases }) => { - if (this.mounted) { - this.setState({ loading: false, testCases }); - } - }, - () => { - if (this.mounted) { - this.setState({ loading: false }); - } - } - ); - }; - - handleTestCasesSortClick = (event: React.SyntheticEvent<HTMLAnchorElement>) => { - event.preventDefault(); - event.currentTarget.blur(); - const { sort } = event.currentTarget.dataset; - if (sort) { - this.setState((state: State) => ({ - sort, - sortAsc: sort === state.sort ? !state.sortAsc : true - })); - } - }; - - handleTestCaseClick = (selectedTestId: string) => { - this.setState({ selectedTestId }); - }; - - render() { - const { selectedTestId, sort = 'name', sortAsc = true, testCases } = this.state; - - if (!testCases) { - return null; - } - - const selectedTest = testCases.find(test => test.id === selectedTestId); - - return ( - <div className="source-viewer-measures"> - <div className="source-viewer-measures-section source-viewer-measures-section-big"> - <div className="source-viewer-measures-card source-viewer-measures-card-fixed-height js-test-list"> - <div className="measures"> - <table className="source-viewer-tests-list"> - <tbody> - <tr> - <td className="source-viewer-test-status note" colSpan={3}> - {translate('component_viewer.measure_section.unit_tests')} - <br /> - <span className="spacer-right"> - {translate('component_viewer.tests.ordered_by')} - </span> - <a - className={classNames('js-sort-tests-by-duration', { - 'active-link': sort === 'duration' - })} - data-sort="duration" - href="#" - onClick={this.handleTestCasesSortClick}> - {translate('component_viewer.tests.duration')} - </a> - <span className="slash-separator" /> - <a - className={classNames('js-sort-tests-by-name', { - 'active-link': sort === 'name' - })} - data-sort="name" - href="#" - onClick={this.handleTestCasesSortClick}> - {translate('component_viewer.tests.test_name')} - </a> - <span className="slash-separator" /> - <a - className={classNames('js-sort-tests-by-status', { - 'active-link': sort === 'status' - })} - data-sort="status" - href="#" - onClick={this.handleTestCasesSortClick}> - {translate('component_viewer.tests.status')} - </a> - </td> - <td className="source-viewer-test-covered-lines note"> - {translate('component_viewer.covered_lines')} - </td> - </tr> - {sortTestCases(testCases, sort, sortAsc).map(testCase => ( - <MeasuresOverlayTestCase - key={testCase.id} - onClick={this.handleTestCaseClick} - testCase={testCase} - /> - ))} - </tbody> - </table> - </div> - </div> - </div> - {selectedTest && <MeasuresOverlayCoveredFiles testCase={selectedTest} />} - </div> - ); - } -} - -function sortTestCases(testCases: T.TestCase[], sort: string, sortAsc: boolean) { - const mainOrder = sortAsc ? 'asc' : 'desc'; - if (sort === 'duration') { - return orderBy(testCases, ['durationInMs', 'name'], [mainOrder, 'asc']); - } else if (sort === 'status') { - return orderBy(testCases, ['status', 'name'], [mainOrder, 'asc']); - } else { - return orderBy(testCases, ['name'], [mainOrder]); - } -} diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlayCoveredFiles-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlayCoveredFiles-test.tsx deleted file mode 100644 index 4be9b29f714..00000000000 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlayCoveredFiles-test.tsx +++ /dev/null @@ -1,55 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import * as React from 'react'; -import { shallow } from 'enzyme'; -import MeasuresOverlayCoveredFiles from '../MeasuresOverlayCoveredFiles'; -import { waitAndUpdate } from '../../../../helpers/testUtils'; - -jest.mock('../../../../api/tests', () => ({ - getCoveredFiles: () => - Promise.resolve([{ key: 'project:src/file.js', longName: 'src/file.js', coveredLines: 3 }]) -})); - -const testCase = { - coveredLines: 3, - durationInMs: 1, - fileId: 'abcd', - fileKey: 'project:test.js', - fileName: 'test.js', - id: 'test-abcd', - name: 'should work', - status: 'OK' -}; - -it('should render OK test', async () => { - const wrapper = shallow(<MeasuresOverlayCoveredFiles testCase={testCase} />); - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot(); -}); - -it('should render ERROR test', async () => { - const wrapper = shallow( - <MeasuresOverlayCoveredFiles - testCase={{ ...testCase, status: 'ERROR', message: 'Something failed' }} - /> - ); - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot(); -}); diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlayTestCase-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlayTestCase-test.tsx deleted file mode 100644 index 6c51c7c3433..00000000000 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlayTestCase-test.tsx +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import * as React from 'react'; -import { shallow } from 'enzyme'; -import MeasuresOverlayTestCase from '../MeasuresOverlayTestCase'; -import { click } from '../../../../helpers/testUtils'; - -const testCase = { - coveredLines: 3, - durationInMs: 1, - fileId: 'abcd', - fileKey: 'project:test.js', - fileName: 'test.js', - id: 'test-abcd', - name: 'should work', - status: 'OK' -}; - -it('should render', () => { - const onClick = jest.fn(); - const wrapper = shallow(<MeasuresOverlayTestCase onClick={onClick} testCase={testCase} />); - expect(wrapper).toMatchSnapshot(); - click(wrapper.find('a')); - expect(onClick).toBeCalledWith('test-abcd'); -}); diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlayTestCases-test.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlayTestCases-test.tsx deleted file mode 100644 index 47b3d3e8612..00000000000 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/MeasuresOverlayTestCases-test.tsx +++ /dev/null @@ -1,81 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import * as React from 'react'; -import { shallow } from 'enzyme'; -import MeasuresOverlayTestCases from '../MeasuresOverlayTestCases'; -import { waitAndUpdate, click } from '../../../../helpers/testUtils'; - -jest.mock('../../../../api/tests', () => ({ - getTests: () => - Promise.resolve({ - tests: [ - { - id: 'AWGub2mGGZxsAttCZwQy', - name: 'testAdd_WhichFails', - fileKey: 'test:fake-project-for-tests:src/test/java/bar/SimplestTest.java', - fileName: 'src/test/java/bar/SimplestTest.java', - status: 'FAILURE', - durationInMs: 6, - coveredLines: 3, - message: 'expected:<9> but was:<2>', - stacktrace: - 'java.lang.AssertionError: expected:<9> but was:<2>\n\tat org.junit.Assert.fail(Assert.java:93)\n\tat org.junit.Assert.failNotEquals(Assert.java:647)' - }, - { - id: 'AWGub2mGGZxsAttCZwQz', - name: 'testAdd_InError', - fileKey: 'test:fake-project-for-tests:src/test/java/bar/SimplestTest.java', - fileName: 'src/test/java/bar/SimplestTest.java', - status: 'ERROR', - durationInMs: 2, - coveredLines: 3 - }, - { - id: 'AWGub2mFGZxsAttCZwQx', - name: 'testAdd', - fileKey: 'test:fake-project-for-tests:src/test/java/bar/SimplestTest.java', - fileName: 'src/test/java/bar/SimplestTest.java', - status: 'OK', - durationInMs: 8, - coveredLines: 3 - } - ] - }) -})); - -const branchLike: T.ShortLivingBranch = { - isMain: false, - mergeBranch: 'master', - name: 'feature', - type: 'SHORT' -}; - -it('should render', async () => { - const wrapper = shallow( - <MeasuresOverlayTestCases branchLike={branchLike} componentKey="component-key" /> - ); - await waitAndUpdate(wrapper); - expect(wrapper).toMatchSnapshot(); - - click(wrapper.find('.js-sort-tests-by-duration'), { - currentTarget: { blur() {}, dataset: { sort: 'duration' } } - }); - expect(wrapper).toMatchSnapshot(); -}); diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlay-test.tsx.snap b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlay-test.tsx.snap index c9d29c53be1..46c32fbc0ce 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlay-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlay-test.tsx.snap @@ -1494,17 +1494,6 @@ exports[`should render test file 1`] = ` </div> </div> </div> - <MeasuresOverlayTestCases - branchLike={ - Object { - "isMain": false, - "mergeBranch": "master", - "name": "feature", - "type": "SHORT", - } - } - componentKey="component-key" - /> <div className="spacer-top" > diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlayCoveredFiles-test.tsx.snap b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlayCoveredFiles-test.tsx.snap deleted file mode 100644 index a2bba908631..00000000000 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlayCoveredFiles-test.tsx.snap +++ /dev/null @@ -1,72 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render ERROR test 1`] = ` -<div - className="source-viewer-measures-section source-viewer-measures-section-big js-selected-test" -> - <DeferredSpinner - loading={false} - timeout={100} - > - <div - className="source-viewer-measures-card source-viewer-measures-card-fixed-height" - > - <h6 - className="spacer-bottom" - > - component_viewer.details - </h6> - <pre> - Something failed - </pre> - <pre /> - </div> - </DeferredSpinner> -</div> -`; - -exports[`should render OK test 1`] = ` -<div - className="source-viewer-measures-section source-viewer-measures-section-big js-selected-test" -> - <DeferredSpinner - loading={false} - timeout={100} - > - <div - className="source-viewer-measures-card source-viewer-measures-card-fixed-height" - > - <h6 - className="spacer-bottom" - > - component_viewer.transition.covers - </h6> - <div - className="spacer-top" - key="project:src/file.js" - > - <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/dashboard", - "query": Object { - "branch": undefined, - "id": "project:src/file.js", - }, - } - } - > - src/file.js - </Link> - <span - className="note spacer-left" - > - component_viewer.x_lines_are_covered.3 - </span> - </div> - </div> - </DeferredSpinner> -</div> -`; diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlayTestCase-test.tsx.snap b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlayTestCase-test.tsx.snap deleted file mode 100644 index 02553e953e9..00000000000 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlayTestCase-test.tsx.snap +++ /dev/null @@ -1,34 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render 1`] = ` -<tr> - <td - className="source-viewer-test-status" - > - <TestStatusIcon - status="OK" - /> - </td> - <td - className="source-viewer-test-duration note" - > - 1ms - </td> - <td - className="source-viewer-test-name" - > - <a - className="js-show-test" - href="#" - onClick={[Function]} - > - should work - </a> - </td> - <td - className="source-viewer-test-covered-lines note" - > - 3 - </td> -</tr> -`; diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlayTestCases-test.tsx.snap b/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlayTestCases-test.tsx.snap deleted file mode 100644 index 78316c348a8..00000000000 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/__tests__/__snapshots__/MeasuresOverlayTestCases-test.tsx.snap +++ /dev/null @@ -1,247 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render 1`] = ` -<div - className="source-viewer-measures" -> - <div - className="source-viewer-measures-section source-viewer-measures-section-big" - > - <div - className="source-viewer-measures-card source-viewer-measures-card-fixed-height js-test-list" - > - <div - className="measures" - > - <table - className="source-viewer-tests-list" - > - <tbody> - <tr> - <td - className="source-viewer-test-status note" - colSpan={3} - > - component_viewer.measure_section.unit_tests - <br /> - <span - className="spacer-right" - > - component_viewer.tests.ordered_by - </span> - <a - className="js-sort-tests-by-duration" - data-sort="duration" - href="#" - onClick={[Function]} - > - component_viewer.tests.duration - </a> - <span - className="slash-separator" - /> - <a - className="js-sort-tests-by-name active-link" - data-sort="name" - href="#" - onClick={[Function]} - > - component_viewer.tests.test_name - </a> - <span - className="slash-separator" - /> - <a - className="js-sort-tests-by-status" - data-sort="status" - href="#" - onClick={[Function]} - > - component_viewer.tests.status - </a> - </td> - <td - className="source-viewer-test-covered-lines note" - > - component_viewer.covered_lines - </td> - </tr> - <MeasuresOverlayTestCase - key="AWGub2mFGZxsAttCZwQx" - onClick={[Function]} - testCase={ - Object { - "coveredLines": 3, - "durationInMs": 8, - "fileKey": "test:fake-project-for-tests:src/test/java/bar/SimplestTest.java", - "fileName": "src/test/java/bar/SimplestTest.java", - "id": "AWGub2mFGZxsAttCZwQx", - "name": "testAdd", - "status": "OK", - } - } - /> - <MeasuresOverlayTestCase - key="AWGub2mGGZxsAttCZwQz" - onClick={[Function]} - testCase={ - Object { - "coveredLines": 3, - "durationInMs": 2, - "fileKey": "test:fake-project-for-tests:src/test/java/bar/SimplestTest.java", - "fileName": "src/test/java/bar/SimplestTest.java", - "id": "AWGub2mGGZxsAttCZwQz", - "name": "testAdd_InError", - "status": "ERROR", - } - } - /> - <MeasuresOverlayTestCase - key="AWGub2mGGZxsAttCZwQy" - onClick={[Function]} - testCase={ - Object { - "coveredLines": 3, - "durationInMs": 6, - "fileKey": "test:fake-project-for-tests:src/test/java/bar/SimplestTest.java", - "fileName": "src/test/java/bar/SimplestTest.java", - "id": "AWGub2mGGZxsAttCZwQy", - "message": "expected:<9> but was:<2>", - "name": "testAdd_WhichFails", - "stacktrace": "java.lang.AssertionError: expected:<9> but was:<2> - at org.junit.Assert.fail(Assert.java:93) - at org.junit.Assert.failNotEquals(Assert.java:647)", - "status": "FAILURE", - } - } - /> - </tbody> - </table> - </div> - </div> - </div> -</div> -`; - -exports[`should render 2`] = ` -<div - className="source-viewer-measures" -> - <div - className="source-viewer-measures-section source-viewer-measures-section-big" - > - <div - className="source-viewer-measures-card source-viewer-measures-card-fixed-height js-test-list" - > - <div - className="measures" - > - <table - className="source-viewer-tests-list" - > - <tbody> - <tr> - <td - className="source-viewer-test-status note" - colSpan={3} - > - component_viewer.measure_section.unit_tests - <br /> - <span - className="spacer-right" - > - component_viewer.tests.ordered_by - </span> - <a - className="js-sort-tests-by-duration active-link" - data-sort="duration" - href="#" - onClick={[Function]} - > - component_viewer.tests.duration - </a> - <span - className="slash-separator" - /> - <a - className="js-sort-tests-by-name" - data-sort="name" - href="#" - onClick={[Function]} - > - component_viewer.tests.test_name - </a> - <span - className="slash-separator" - /> - <a - className="js-sort-tests-by-status" - data-sort="status" - href="#" - onClick={[Function]} - > - component_viewer.tests.status - </a> - </td> - <td - className="source-viewer-test-covered-lines note" - > - component_viewer.covered_lines - </td> - </tr> - <MeasuresOverlayTestCase - key="AWGub2mGGZxsAttCZwQz" - onClick={[Function]} - testCase={ - Object { - "coveredLines": 3, - "durationInMs": 2, - "fileKey": "test:fake-project-for-tests:src/test/java/bar/SimplestTest.java", - "fileName": "src/test/java/bar/SimplestTest.java", - "id": "AWGub2mGGZxsAttCZwQz", - "name": "testAdd_InError", - "status": "ERROR", - } - } - /> - <MeasuresOverlayTestCase - key="AWGub2mGGZxsAttCZwQy" - onClick={[Function]} - testCase={ - Object { - "coveredLines": 3, - "durationInMs": 6, - "fileKey": "test:fake-project-for-tests:src/test/java/bar/SimplestTest.java", - "fileName": "src/test/java/bar/SimplestTest.java", - "id": "AWGub2mGGZxsAttCZwQy", - "message": "expected:<9> but was:<2>", - "name": "testAdd_WhichFails", - "stacktrace": "java.lang.AssertionError: expected:<9> but was:<2> - at org.junit.Assert.fail(Assert.java:93) - at org.junit.Assert.failNotEquals(Assert.java:647)", - "status": "FAILURE", - } - } - /> - <MeasuresOverlayTestCase - key="AWGub2mFGZxsAttCZwQx" - onClick={[Function]} - testCase={ - Object { - "coveredLines": 3, - "durationInMs": 8, - "fileKey": "test:fake-project-for-tests:src/test/java/bar/SimplestTest.java", - "fileName": "src/test/java/bar/SimplestTest.java", - "id": "AWGub2mFGZxsAttCZwQx", - "name": "testAdd", - "status": "OK", - } - } - /> - </tbody> - </table> - </div> - </div> - </div> -</div> -`; |