+++ /dev/null
-/*
- * 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);
-}
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';
) : (
<>
{sourceViewerFile.q === 'UTS' ? (
- <>
- {this.renderTests()}
- <MeasuresOverlayTestCases
- branchLike={branchLike}
- componentKey={sourceViewerFile.key}
- />
- </>
+ this.renderTests()
) : (
<div className="source-viewer-measures">
{this.renderLines()}
+++ /dev/null
-/*
- * 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>
- );
- }
-}
+++ /dev/null
-/*
- * 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>
- );
- }
-}
+++ /dev/null
-/*
- * 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]);
- }
-}
+++ /dev/null
-/*
- * 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();
-});
+++ /dev/null
-/*
- * 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');
-});
+++ /dev/null
-/*
- * 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();
-});
</div>
</div>
</div>
- <MeasuresOverlayTestCases
- branchLike={
- Object {
- "isMain": false,
- "mergeBranch": "master",
- "name": "feature",
- "type": "SHORT",
- }
- }
- componentKey="component-key"
- />
<div
className="spacer-top"
>
+++ /dev/null
-// 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>
-`;
+++ /dev/null
-// 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>
-`;
+++ /dev/null
-// 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>
-`;