]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-11856 Display true pull request target instead of base
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>
Wed, 3 Apr 2019 12:08:00 +0000 (14:08 +0200)
committerSonarTech <sonartech@sonarsource.com>
Tue, 23 Apr 2019 18:21:08 +0000 (20:21 +0200)
23 files changed:
server/sonar-web/src/main/js/app/components/__tests__/ComponentContainer-test.tsx
server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBranch.tsx
server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBranch-test.tsx
server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavBranchesMenu-test.tsx
server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBranch-test.tsx.snap
server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavBranchesMenu-test.tsx.snap
server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavMeta-test.tsx.snap
server/sonar-web/src/main/js/app/types.d.ts
server/sonar-web/src/main/js/apps/component-measures/components/__tests__/App-test.tsx
server/sonar-web/src/main/js/apps/component-measures/components/__tests__/__snapshots__/App-test.tsx.snap
server/sonar-web/src/main/js/apps/overview/components/__tests__/EmptyOverview-test.tsx
server/sonar-web/src/main/js/apps/overview/components/__tests__/__snapshots__/EmptyOverview-test.tsx.snap
server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/__snapshots__/IssueRating-test.tsx.snap
server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/__snapshots__/MeasurementLabel-test.tsx.snap
server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/__snapshots__/ReviewApp-test.tsx.snap
server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/App-test.tsx
server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/BranchRow-test.tsx
server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/DeleteBranchModal-test.tsx
server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/__snapshots__/App-test.tsx.snap
server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/__snapshots__/BranchRow-test.tsx.snap
server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/__snapshots__/DeleteBranchModal-test.tsx.snap
server/sonar-web/src/main/js/helpers/testMocks.ts
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index 501f1c72365cac9dc143c51f1076cf93d14ace1a..f534409f7cf719ba562cbe8f6c8ba1ac382d5bc6 100644 (file)
@@ -27,33 +27,30 @@ import { getComponentNavigation } from '../../../api/nav';
 import { STATUSES } from '../../../apps/background-tasks/constants';
 import { waitAndUpdate } from '../../../helpers/testUtils';
 import { isSonarCloud } from '../../../helpers/system';
-import { mockLocation, mockRouter, mockComponent } from '../../../helpers/testMocks';
-
-jest.mock('../../../api/branches', () => ({
-  getBranches: jest.fn().mockResolvedValue([
-    {
-      isMain: true,
-      name: 'master',
-      type: 'LONG',
-      status: { qualityGateStatus: 'OK' }
-    }
-  ]),
-  getPullRequests: jest.fn().mockResolvedValue([
-    {
-      base: 'feature',
-      branch: 'feature',
-      key: 'pr-89',
-      title: 'PR Feature',
-      status: { qualityGateStatus: 'ERROR' }
-    },
-    {
-      base: 'feature',
-      branch: 'feature',
-      key: 'pr-90',
-      title: 'PR Feature 2'
-    }
-  ])
-}));
+import {
+  mockLocation,
+  mockRouter,
+  mockComponent,
+  mockPullRequest,
+  mockLongLivingBranch,
+  mockShortLivingBranch,
+  mockMainBranch
+} from '../../../helpers/testMocks';
+
+jest.mock('../../../api/branches', () => {
+  const { mockMainBranch, mockPullRequest } = require.requireActual('../../../helpers/testMocks');
+  return {
+    getBranches: jest
+      .fn()
+      .mockResolvedValue([mockMainBranch({ status: { qualityGateStatus: 'OK' } })]),
+    getPullRequests: jest
+      .fn()
+      .mockResolvedValue([
+        mockPullRequest({ key: 'pr-89', status: { qualityGateStatus: 'ERROR' } }),
+        mockPullRequest({ key: 'pr-90', title: 'PR Feature 2' })
+      ])
+  };
+});
 
 jest.mock('../../../api/ce', () => ({
   getAnalysisStatus: jest.fn().mockResolvedValue({ component: { warnings: [] } }),
@@ -152,30 +149,16 @@ it('fetches status', async () => {
 it('filters correctly the pending tasks for a main branch', () => {
   const wrapper = shallowRender();
   const component = wrapper.instance();
-  const mainBranch: T.MainBranch = { isMain: true, name: 'master' };
-  const shortBranch: T.ShortLivingBranch = {
-    isMain: false,
-    mergeBranch: 'master',
-    name: 'feature',
-    type: 'SHORT'
-  };
-  const longBranch: T.LongLivingBranch = {
-    isMain: false,
-    name: 'branch-7.2',
-    type: 'LONG'
-  };
-  const pullRequest: T.PullRequest = {
-    base: 'feature',
-    branch: 'feature',
-    key: 'pr-89',
-    title: 'PR Feature'
-  };
+  const mainBranch = mockMainBranch();
+  const shortBranch = mockShortLivingBranch();
+  const longBranch = mockLongLivingBranch();
+  const pullRequest = mockPullRequest();
 
   expect(component.isSameBranch({}, undefined)).toBeTruthy();
   expect(component.isSameBranch({}, mainBranch)).toBeTruthy();
   expect(component.isSameBranch({}, shortBranch)).toBeFalsy();
   expect(
-    component.isSameBranch({ branch: 'feature', branchType: 'SHORT' }, shortBranch)
+    component.isSameBranch({ branch: shortBranch.name, branchType: 'SHORT' }, shortBranch)
   ).toBeTruthy();
   expect(
     component.isSameBranch({ branch: 'feature', branchType: 'SHORT' }, longBranch)
@@ -184,18 +167,21 @@ it('filters correctly the pending tasks for a main branch', () => {
     component.isSameBranch({ branch: 'feature', branchType: 'SHORT' }, longBranch)
   ).toBeFalsy();
   expect(
-    component.isSameBranch({ branch: 'branch-7.1', branchType: 'LONG' }, longBranch)
+    component.isSameBranch({ branch: 'branch-6.6', branchType: 'LONG' }, longBranch)
   ).toBeFalsy();
   expect(
-    component.isSameBranch({ branch: 'branch-7.2', branchType: 'LONG' }, pullRequest)
+    component.isSameBranch({ branch: longBranch.name, branchType: 'LONG' }, longBranch)
+  ).toBeTruthy();
+  expect(
+    component.isSameBranch({ branch: 'branch-6.7', branchType: 'LONG' }, pullRequest)
   ).toBeFalsy();
-  expect(component.isSameBranch({ pullRequest: 'pr-89' }, pullRequest)).toBeTruthy();
+  expect(component.isSameBranch({ pullRequest: pullRequest.key }, pullRequest)).toBeTruthy();
 
-  const currentTask = { pullRequest: 'pr-89', status: STATUSES.IN_PROGRESS } as T.Task;
+  const currentTask = { pullRequest: pullRequest.key, status: STATUSES.IN_PROGRESS } as T.Task;
   const failedTask = { ...currentTask, status: STATUSES.FAILED };
   const pendingTasks = [
     currentTask,
-    { branch: 'feature', branchType: 'SHORT' } as T.Task,
+    { branch: shortBranch.name, branchType: 'SHORT' } as T.Task,
     {} as T.Task
   ];
   expect(component.getCurrentTask(currentTask, undefined)).toBe(undefined);
index 0905f0143ef4abe24eb9d53390741099c0e4a39c..3b6ffb947eb44187110ed431e3621f9062626c12 100644 (file)
@@ -109,7 +109,7 @@ export class ComponentNavBranch extends React.PureComponent<Props, State> {
             defaultMessage={translate('branches.pull_request.for_merge_into_x_from_y')}
             id="branches.pull_request.for_merge_into_x_from_y"
             values={{
-              base: <strong>{currentBranchLike.base}</strong>,
+              target: <strong>{currentBranchLike.target}</strong>,
               branch: <strong>{currentBranchLike.branch}</strong>
             }}
           />
index 21a8a1ccb3b45906a588a38aee130f09a5c98227..59ef798f2d6d5a2c8da64c2b3103e26da3b67969 100644 (file)
@@ -22,11 +22,17 @@ import { shallow } from 'enzyme';
 import { ComponentNavBranch } from '../ComponentNavBranch';
 import { click } from '../../../../../helpers/testUtils';
 import { isSonarCloud } from '../../../../../helpers/system';
+import {
+  mockPullRequest,
+  mockShortLivingBranch,
+  mockMainBranch,
+  mockLongLivingBranch
+} from '../../../../../helpers/testMocks';
 
 jest.mock('../../../../../helpers/system', () => ({ isSonarCloud: jest.fn() }));
 
-const mainBranch: T.MainBranch = { isMain: true, name: 'master' };
-const fooBranch: T.LongLivingBranch = { isMain: false, name: 'foo', type: 'LONG' };
+const mainBranch = mockMainBranch();
+const fooBranch = mockLongLivingBranch();
 
 beforeEach(() => {
   (isSonarCloud as jest.Mock).mockImplementation(() => false);
@@ -47,13 +53,9 @@ it('renders main branch', () => {
 });
 
 it('renders short-living branch', () => {
-  const branch: T.ShortLivingBranch = {
-    isMain: false,
-    mergeBranch: 'master',
-    name: 'foo',
-    status: { qualityGateStatus: 'OK' },
-    type: 'SHORT'
-  };
+  const branch: T.ShortLivingBranch = mockShortLivingBranch({
+    status: { qualityGateStatus: 'OK' }
+  });
   const component = {} as T.Component;
   expect(
     shallow(
@@ -68,13 +70,10 @@ it('renders short-living branch', () => {
 });
 
 it('renders pull request', () => {
-  const pullRequest: T.PullRequest = {
-    base: 'master',
-    branch: 'feature',
-    key: '1234',
-    title: 'Feature PR',
+  const pullRequest = mockPullRequest({
+    target: 'feature/foo',
     url: 'https://example.com/pull/1234'
-  };
+  });
   const component = {} as T.Component;
   expect(
     shallow(
index 96ec59ddb2ecf03b364d3a26d6a08d2804a3e111..24b0411de313f6c007c071f9be3b5a3139b33419 100644 (file)
@@ -21,6 +21,12 @@ import * as React from 'react';
 import { shallow } from 'enzyme';
 import { ComponentNavBranchesMenu } from '../ComponentNavBranchesMenu';
 import { elementKeydown } from '../../../../../helpers/testUtils';
+import {
+  mockPullRequest,
+  mockShortLivingBranch,
+  mockLongLivingBranch,
+  mockMainBranch
+} from '../../../../../helpers/testMocks';
 
 const component = { key: 'component' } as T.Component;
 
@@ -29,14 +35,14 @@ it('renders list', () => {
     shallow(
       <ComponentNavBranchesMenu
         branchLikes={[
-          mainBranch(),
+          mockMainBranch(),
           shortBranch('foo'),
-          longBranch('bar'),
+          mockLongLivingBranch({ name: 'bar' }),
           shortBranch('baz', true),
-          pullRequest('qux')
+          mockPullRequest({ status: { qualityGateStatus: 'OK' }, title: 'qux' })
         ]}
         component={component}
-        currentBranchLike={mainBranch()}
+        currentBranchLike={mockMainBranch()}
         onClose={jest.fn()}
         router={{ push: jest.fn() }}
       />
@@ -48,14 +54,14 @@ it('searches', () => {
   const wrapper = shallow(
     <ComponentNavBranchesMenu
       branchLikes={[
-        mainBranch(),
+        mockMainBranch(),
         shortBranch('foo'),
         shortBranch('foobar'),
-        longBranch('bar'),
-        longBranch('BARBAZ')
+        mockLongLivingBranch({ name: 'bar' }),
+        mockLongLivingBranch({ name: 'BARBAZ' })
       ]}
       component={component}
-      currentBranchLike={mainBranch()}
+      currentBranchLike={mockMainBranch()}
       onClose={jest.fn()}
       router={{ push: jest.fn() }}
     />
@@ -67,9 +73,14 @@ it('searches', () => {
 it('selects next & previous', () => {
   const wrapper = shallow<ComponentNavBranchesMenu>(
     <ComponentNavBranchesMenu
-      branchLikes={[mainBranch(), shortBranch('foo'), shortBranch('foobar'), longBranch('bar')]}
+      branchLikes={[
+        mockMainBranch(),
+        shortBranch('foo'),
+        shortBranch('foobar'),
+        mockLongLivingBranch({ name: 'bar' })
+      ]}
       component={component}
-      currentBranchLike={mainBranch()}
+      currentBranchLike={mockMainBranch()}
       onClose={jest.fn()}
       router={{ push: jest.fn() }}
     />
@@ -85,31 +96,6 @@ it('selects next & previous', () => {
   expect(wrapper.state().selected).toEqual(shortBranch('foo'));
 });
 
-function mainBranch(): T.MainBranch {
-  return { isMain: true, name: 'master' };
-}
-
-function shortBranch(name: string, isOrphan?: true): T.ShortLivingBranch {
-  return {
-    isMain: false,
-    isOrphan,
-    mergeBranch: 'master',
-    name,
-    status: { qualityGateStatus: 'OK' },
-    type: 'SHORT'
-  };
-}
-
-function longBranch(name: string): T.LongLivingBranch {
-  return { isMain: false, name, type: 'LONG' };
-}
-
-function pullRequest(title: string): T.PullRequest {
-  return {
-    base: 'master',
-    branch: 'feature',
-    key: '1234',
-    status: { qualityGateStatus: 'OK' },
-    title
-  };
+function shortBranch(name: string, isOrphan?: true) {
+  return mockShortLivingBranch({ name, isOrphan, status: { qualityGateStatus: 'OK' } });
 }
index f9e722af3053118f2b6cf237406a31bd76ca70a7..41d56c5bb5896855d72254c8f028af1d1ff72613 100644 (file)
@@ -15,12 +15,14 @@ exports[`renders main branch 1`] = `
           branchLikes={
             Array [
               Object {
+                "analysisDate": "2018-01-01",
                 "isMain": true,
                 "name": "master",
               },
               Object {
+                "analysisDate": "2018-01-01",
                 "isMain": false,
-                "name": "foo",
+                "name": "branch-6.7",
                 "type": "LONG",
               },
             ]
@@ -28,6 +30,7 @@ exports[`renders main branch 1`] = `
           component={Object {}}
           currentBranchLike={
             Object {
+              "analysisDate": "2018-01-01",
               "isMain": true,
               "name": "master",
             }
@@ -44,6 +47,7 @@ exports[`renders main branch 1`] = `
         <BranchIcon
           branchLike={
             Object {
+              "analysisDate": "2018-01-01",
               "isMain": true,
               "name": "master",
             }
@@ -92,15 +96,18 @@ exports[`renders pull request 1`] = `
           branchLikes={
             Array [
               Object {
+                "analysisDate": "2018-01-01",
                 "base": "master",
-                "branch": "feature",
-                "key": "1234",
-                "title": "Feature PR",
+                "branch": "feature/foo/bar",
+                "key": "1001",
+                "target": "feature/foo",
+                "title": "Foo Bar feature",
                 "url": "https://example.com/pull/1234",
               },
               Object {
+                "analysisDate": "2018-01-01",
                 "isMain": false,
-                "name": "foo",
+                "name": "branch-6.7",
                 "type": "LONG",
               },
             ]
@@ -108,10 +115,12 @@ exports[`renders pull request 1`] = `
           component={Object {}}
           currentBranchLike={
             Object {
+              "analysisDate": "2018-01-01",
               "base": "master",
-              "branch": "feature",
-              "key": "1234",
-              "title": "Feature PR",
+              "branch": "feature/foo/bar",
+              "key": "1001",
+              "target": "feature/foo",
+              "title": "Foo Bar feature",
               "url": "https://example.com/pull/1234",
             }
           }
@@ -127,10 +136,12 @@ exports[`renders pull request 1`] = `
         <BranchIcon
           branchLike={
             Object {
+              "analysisDate": "2018-01-01",
               "base": "master",
-              "branch": "feature",
-              "key": "1234",
-              "title": "Feature PR",
+              "branch": "feature/foo/bar",
+              "key": "1001",
+              "target": "feature/foo",
+              "title": "Foo Bar feature",
               "url": "https://example.com/pull/1234",
             }
           }
@@ -138,9 +149,9 @@ exports[`renders pull request 1`] = `
         />
         <span
           className="text-limited text-top"
-          title="1234 – Feature PR"
+          title="1001 – Foo Bar feature"
         >
-          1234 – Feature PR
+          1001 – Foo Bar feature
         </span>
         <DropdownIcon
           className="little-spacer-left"
@@ -156,11 +167,11 @@ exports[`renders pull request 1`] = `
       id="branches.pull_request.for_merge_into_x_from_y"
       values={
         Object {
-          "base": <strong>
-            master
-          </strong>,
           "branch": <strong>
-            feature
+            feature/foo/bar
+          </strong>,
+          "target": <strong>
+            feature/foo
           </strong>,
         }
       }
@@ -184,17 +195,19 @@ exports[`renders short-living branch 1`] = `
           branchLikes={
             Array [
               Object {
+                "analysisDate": "2018-01-01",
                 "isMain": false,
                 "mergeBranch": "master",
-                "name": "foo",
+                "name": "feature/foo",
                 "status": Object {
                   "qualityGateStatus": "OK",
                 },
                 "type": "SHORT",
               },
               Object {
+                "analysisDate": "2018-01-01",
                 "isMain": false,
-                "name": "foo",
+                "name": "branch-6.7",
                 "type": "LONG",
               },
             ]
@@ -202,9 +215,10 @@ exports[`renders short-living branch 1`] = `
           component={Object {}}
           currentBranchLike={
             Object {
+              "analysisDate": "2018-01-01",
               "isMain": false,
               "mergeBranch": "master",
-              "name": "foo",
+              "name": "feature/foo",
               "status": Object {
                 "qualityGateStatus": "OK",
               },
@@ -223,9 +237,10 @@ exports[`renders short-living branch 1`] = `
         <BranchIcon
           branchLike={
             Object {
+              "analysisDate": "2018-01-01",
               "isMain": false,
               "mergeBranch": "master",
-              "name": "foo",
+              "name": "feature/foo",
               "status": Object {
                 "qualityGateStatus": "OK",
               },
@@ -236,9 +251,9 @@ exports[`renders short-living branch 1`] = `
         />
         <span
           className="text-limited text-top"
-          title="foo"
+          title="feature/foo"
         >
-          foo
+          feature/foo
         </span>
         <DropdownIcon
           className="little-spacer-left"
index c4bc94a269012f2c7222af9ebb0eeba16b909330..561e853fce9bfd8e2f0672081e7975dddccf9a19 100644 (file)
@@ -21,6 +21,7 @@ exports[`renders list 1`] = `
     <ComponentNavBranchesMenuItem
       branchLike={
         Object {
+          "analysisDate": "2018-01-01",
           "isMain": true,
           "name": "master",
         }
@@ -43,12 +44,14 @@ exports[`renders list 1`] = `
     <ComponentNavBranchesMenuItem
       branchLike={
         Object {
+          "analysisDate": "2018-01-01",
           "base": "master",
-          "branch": "feature",
-          "key": "1234",
+          "branch": "feature/foo/bar",
+          "key": "1001",
           "status": Object {
             "qualityGateStatus": "OK",
           },
+          "target": "master",
           "title": "qux",
         }
       }
@@ -58,7 +61,7 @@ exports[`renders list 1`] = `
         }
       }
       innerRef={[Function]}
-      key="pull-request-1234"
+      key="pull-request-1001"
       onSelect={[Function]}
       selected={false}
     />
@@ -81,6 +84,7 @@ exports[`renders list 1`] = `
     <ComponentNavBranchesMenuItem
       branchLike={
         Object {
+          "analysisDate": "2018-01-01",
           "isMain": false,
           "isOrphan": true,
           "mergeBranch": "master",
@@ -104,6 +108,7 @@ exports[`renders list 1`] = `
     <ComponentNavBranchesMenuItem
       branchLike={
         Object {
+          "analysisDate": "2018-01-01",
           "isMain": false,
           "isOrphan": undefined,
           "mergeBranch": "master",
@@ -130,6 +135,7 @@ exports[`renders list 1`] = `
     <ComponentNavBranchesMenuItem
       branchLike={
         Object {
+          "analysisDate": "2018-01-01",
           "isMain": false,
           "name": "bar",
           "type": "LONG",
@@ -164,6 +170,7 @@ exports[`renders list 1`] = `
     <ComponentNavBranchesMenuItem
       branchLike={
         Object {
+          "analysisDate": "2018-01-01",
           "isMain": false,
           "isOrphan": true,
           "mergeBranch": "master",
@@ -214,6 +221,7 @@ exports[`searches 1`] = `
     <ComponentNavBranchesMenuItem
       branchLike={
         Object {
+          "analysisDate": "2018-01-01",
           "isMain": false,
           "isOrphan": undefined,
           "mergeBranch": "master",
@@ -240,6 +248,7 @@ exports[`searches 1`] = `
     <ComponentNavBranchesMenuItem
       branchLike={
         Object {
+          "analysisDate": "2018-01-01",
           "isMain": false,
           "name": "BARBAZ",
           "type": "LONG",
@@ -261,6 +270,7 @@ exports[`searches 1`] = `
     <ComponentNavBranchesMenuItem
       branchLike={
         Object {
+          "analysisDate": "2018-01-01",
           "isMain": false,
           "name": "bar",
           "type": "LONG",
index e8ea68e57422c2733589f6da4bd089b82ac25d9e..dd33e35146136ccd1ec329ae2b4113967ad99a7b 100644 (file)
@@ -30,7 +30,7 @@ exports[`#ComponentNavMeta renders meta for long-living branch 1`] = `
       className="spacer-left"
       currentPage={
         Object {
-          "branch": "master",
+          "branch": "branch-6.7",
           "component": "my-project",
           "type": "PROJECT",
         }
@@ -73,6 +73,7 @@ exports[`#ComponentNavMeta renders meta for pull request 1`] = `
           "base": "master",
           "branch": "feature/foo/bar",
           "key": "1001",
+          "target": "master",
           "title": "Foo Bar feature",
           "url": "https://example.com/pull/1234",
         }
@@ -103,7 +104,7 @@ exports[`#ComponentNavMeta renders status of short-living branch 1`] = `
           "analysisDate": "2018-01-01",
           "isMain": false,
           "mergeBranch": "master",
-          "name": "release-1.0",
+          "name": "feature/foo",
           "type": "SHORT",
         }
       }
index 92aefb08734cd716c66a9491b2666248c82091d3..b8e02584b8a24c8ac889b2ab5c5e4c13fd9b99ca 100644 (file)
@@ -625,6 +625,7 @@ declare namespace T {
     key: string;
     isOrphan?: true;
     status?: { qualityGateStatus: Status };
+    target: string;
     title: string;
     url?: string;
   }
index ad3c05ee775810e3475ebdf337514d2db9143735..108c9a45d0b7037e7e01cb9e0e80943708a809ea 100644 (file)
@@ -23,6 +23,7 @@ import { Location } from 'history';
 import { App } from '../App';
 import { waitAndUpdate } from '../../../../helpers/testUtils';
 import { getMeasuresAndMeta } from '../../../../api/measures';
+import { mockPullRequest, mockMainBranch } from '../../../../helpers/testMocks';
 
 jest.mock('../../../../api/metrics', () => ({
   getAllMetrics: jest.fn().mockResolvedValue([
@@ -64,7 +65,7 @@ jest.mock('../../../../api/measures', () => ({
 const COMPONENT = { key: 'foo', name: 'Foo', qualifier: 'TRK' };
 
 const PROPS: App['props'] = {
-  branchLike: { isMain: true, name: 'master' },
+  branchLike: mockMainBranch(),
   component: COMPONENT,
   location: { pathname: '/component_measures', query: { metric: 'coverage' } } as Location,
   params: {},
@@ -109,8 +110,7 @@ it('should render a message when there are no measures', async () => {
 });
 
 it('should not render drilldown for estimated duplications', async () => {
-  const pullRequest = { base: 'master', branch: 'feature-x', key: '5', title: '' };
-  const wrapper = shallow(<App {...PROPS} branchLike={pullRequest} />);
+  const wrapper = shallow(<App {...PROPS} branchLike={mockPullRequest({ title: '' })} />);
   await waitAndUpdate(wrapper);
   expect(wrapper).toMatchSnapshot();
 });
index e90f3b035eaa3c291432934e892e5e2bcbcf2a08..2de9484e8fd5b56b85cb51a2036403b19e86c69f 100644 (file)
@@ -76,6 +76,7 @@ exports[`should render correctly 1`] = `
     <MeasureContent
       branchLike={
         Object {
+          "analysisDate": "2018-01-01",
           "isMain": true,
           "name": "master",
         }
index bd4dd8ca3d48183c880322655263f024c2deeddf..1d986047c0c035bfdf945ce148c671e72c9b749c 100644 (file)
 import * as React from 'react';
 import { shallow } from 'enzyme';
 import { EmptyOverview, WarningMessage } from '../EmptyOverview';
+import {
+  mockPullRequest,
+  mockLoggedInUser,
+  mockMainBranch,
+  mockComponent
+} from '../../../../helpers/testMocks';
 
-const branch = { isMain: true, name: 'b', type: 'LONG' };
-
-const component = {
-  key: 'foo',
-  analysisDate: '2016-01-01',
-  breadcrumbs: [],
-  name: 'Foo',
-  organization: 'org',
-  qualifier: 'TRK',
-  version: '0.0.1'
-};
-
-const LoggedInUser = {
-  isLoggedIn: true,
-  login: 'luke',
-  name: 'Skywalker'
-};
+const branch = mockMainBranch();
+const component = mockComponent({ version: '0.0.1' });
+const LoggedInUser = mockLoggedInUser();
 
 it('renders correctly', () => {
   expect(
@@ -99,17 +91,7 @@ it('should render warning message', () => {
 
 it('should not render warning message', () => {
   expect(
-    shallow(
-      <WarningMessage
-        branchLike={{
-          base: 'foo',
-          branch: 'bar',
-          key: '1',
-          title: 'PR bar'
-        }}
-        message="foo"
-      />
-    )
+    shallow(<WarningMessage branchLike={mockPullRequest()} message="foo" />)
       .find('FormattedMessage')
       .exists()
   ).toBeFalsy();
index ed33bf33c66c7c190e81b1b1825c2fc8408e4365..22173c3d13f771fb44a0567cbabd08d3a0b33889 100644 (file)
@@ -13,20 +13,35 @@ exports[`renders correctly 1`] = `
       <AnalyzeTutorial
         component={
           Object {
-            "analysisDate": "2016-01-01",
             "breadcrumbs": Array [],
-            "key": "foo",
-            "name": "Foo",
-            "organization": "org",
+            "key": "my-project",
+            "name": "MyProject",
+            "organization": "foo",
             "qualifier": "TRK",
+            "qualityGate": Object {
+              "isDefault": true,
+              "key": "30",
+              "name": "Sonar way",
+            },
+            "qualityProfiles": Array [
+              Object {
+                "deleted": false,
+                "key": "my-qp",
+                "language": "ts",
+                "name": "Sonar way",
+              },
+            ],
+            "tags": Array [],
             "version": "0.0.1",
           }
         }
         currentUser={
           Object {
+            "groups": Array [],
             "isLoggedIn": true,
             "login": "luke",
             "name": "Skywalker",
+            "scmAccounts": Array [],
           }
         }
       />
@@ -37,19 +52,32 @@ exports[`renders correctly 1`] = `
       <Connect(Meta)
         branchLike={
           Object {
+            "analysisDate": "2018-01-01",
             "isMain": true,
-            "name": "b",
-            "type": "LONG",
+            "name": "master",
           }
         }
         component={
           Object {
-            "analysisDate": "2016-01-01",
             "breadcrumbs": Array [],
-            "key": "foo",
-            "name": "Foo",
-            "organization": "org",
+            "key": "my-project",
+            "name": "MyProject",
+            "organization": "foo",
             "qualifier": "TRK",
+            "qualityGate": Object {
+              "isDefault": true,
+              "key": "30",
+              "name": "Sonar way",
+            },
+            "qualityProfiles": Array [
+              Object {
+                "deleted": false,
+                "key": "my-qp",
+                "language": "ts",
+                "name": "Sonar way",
+              },
+            ],
+            "tags": Array [],
             "version": "0.0.1",
           }
         }
@@ -76,19 +104,32 @@ exports[`should not render the tutorial 1`] = `
       <Connect(Meta)
         branchLike={
           Object {
+            "analysisDate": "2018-01-01",
             "isMain": true,
-            "name": "b",
-            "type": "LONG",
+            "name": "master",
           }
         }
         component={
           Object {
-            "analysisDate": "2016-01-01",
             "breadcrumbs": Array [],
-            "key": "foo",
-            "name": "Foo",
-            "organization": "org",
+            "key": "my-project",
+            "name": "MyProject",
+            "organization": "foo",
             "qualifier": "TRK",
+            "qualityGate": Object {
+              "isDefault": true,
+              "key": "30",
+              "name": "Sonar way",
+            },
+            "qualityProfiles": Array [
+              Object {
+                "deleted": false,
+                "key": "my-qp",
+                "language": "ts",
+                "name": "Sonar way",
+              },
+            ],
+            "tags": Array [],
             "version": "0.0.1",
           }
         }
@@ -112,9 +153,9 @@ exports[`should render another message when there are branches 1`] = `
       <WarningMessage
         branchLike={
           Object {
+            "analysisDate": "2018-01-01",
             "isMain": true,
-            "name": "b",
-            "type": "LONG",
+            "name": "master",
           }
         }
         message="provisioning.no_analysis_on_main_branch"
@@ -126,19 +167,32 @@ exports[`should render another message when there are branches 1`] = `
       <Connect(Meta)
         branchLike={
           Object {
+            "analysisDate": "2018-01-01",
             "isMain": true,
-            "name": "b",
-            "type": "LONG",
+            "name": "master",
           }
         }
         component={
           Object {
-            "analysisDate": "2016-01-01",
             "breadcrumbs": Array [],
-            "key": "foo",
-            "name": "Foo",
-            "organization": "org",
+            "key": "my-project",
+            "name": "MyProject",
+            "organization": "foo",
             "qualifier": "TRK",
+            "qualityGate": Object {
+              "isDefault": true,
+              "key": "30",
+              "name": "Sonar way",
+            },
+            "qualityProfiles": Array [
+              Object {
+                "deleted": false,
+                "key": "my-qp",
+                "language": "ts",
+                "name": "Sonar way",
+              },
+            ],
+            "tags": Array [],
             "version": "0.0.1",
           }
         }
@@ -162,9 +216,9 @@ exports[`should render another message when there are branches 2`] = `
       <WarningMessage
         branchLike={
           Object {
+            "analysisDate": "2018-01-01",
             "isMain": true,
-            "name": "b",
-            "type": "LONG",
+            "name": "master",
           }
         }
         message="provisioning.no_analysis_on_main_branch.bad_configuration"
@@ -176,19 +230,32 @@ exports[`should render another message when there are branches 2`] = `
       <Connect(Meta)
         branchLike={
           Object {
+            "analysisDate": "2018-01-01",
             "isMain": true,
-            "name": "b",
-            "type": "LONG",
+            "name": "master",
           }
         }
         component={
           Object {
-            "analysisDate": "2016-01-01",
             "breadcrumbs": Array [],
-            "key": "foo",
-            "name": "Foo",
-            "organization": "org",
+            "key": "my-project",
+            "name": "MyProject",
+            "organization": "foo",
             "qualifier": "TRK",
+            "qualityGate": Object {
+              "isDefault": true,
+              "key": "30",
+              "name": "Sonar way",
+            },
+            "qualityProfiles": Array [
+              Object {
+                "deleted": false,
+                "key": "my-qp",
+                "language": "ts",
+                "name": "Sonar way",
+              },
+            ],
+            "tags": Array [],
             "version": "0.0.1",
           }
         }
@@ -208,7 +275,7 @@ exports[`should render warning message 1`] = `
     id="foo"
     values={
       Object {
-        "branchName": "b",
+        "branchName": "master",
         "branchType": <div
           className="outline-badge text-baseline"
         >
index d21f078275dabdd005d1d353083b3511e84e4d32..7025894710cb60e1bd10d6ceb51861def75de0eb 100644 (file)
@@ -18,6 +18,7 @@ exports[`should render correctly for bugs 1`] = `
             "base": "master",
             "branch": "feature/foo/bar",
             "key": "1001",
+            "target": "master",
             "title": "Foo Bar feature",
           }
         }
@@ -52,6 +53,7 @@ exports[`should render correctly for code smells 1`] = `
             "base": "master",
             "branch": "feature/foo/bar",
             "key": "1001",
+            "target": "master",
             "title": "Foo Bar feature",
           }
         }
@@ -86,6 +88,7 @@ exports[`should render correctly for vulnerabilities 1`] = `
             "base": "master",
             "branch": "feature/foo/bar",
             "key": "1001",
+            "target": "master",
             "title": "Foo Bar feature",
           }
         }
index 4885a7e58220d0f20ca94ad950edc57c7b10207d..80d2067bc1b1837e5a40017cb520e36202456a71 100644 (file)
@@ -16,7 +16,7 @@ exports[`should render correctly for coverage 1`] = `
         "analysisDate": "2018-01-01",
         "isMain": false,
         "mergeBranch": "master",
-        "name": "release-1.0",
+        "name": "feature/foo",
         "type": "SHORT",
       }
     }
@@ -49,7 +49,7 @@ exports[`should render correctly for coverage 2`] = `
         "analysisDate": "2018-01-01",
         "isMain": false,
         "mergeBranch": "master",
-        "name": "release-1.0",
+        "name": "feature/foo",
         "type": "SHORT",
       }
     }
@@ -72,7 +72,7 @@ exports[`should render correctly for coverage 2`] = `
                 "analysisDate": "2018-01-01",
                 "isMain": false,
                 "mergeBranch": "master",
-                "name": "release-1.0",
+                "name": "feature/foo",
                 "type": "SHORT",
               }
             }
@@ -104,7 +104,7 @@ exports[`should render correctly for duplications 1`] = `
         "analysisDate": "2018-01-01",
         "isMain": false,
         "mergeBranch": "master",
-        "name": "release-1.0",
+        "name": "feature/foo",
         "type": "SHORT",
       }
     }
index a850b2f999b1599417a63ddb442a1373bfdf63ef..af5bcaf2da0ef8e5727f5189781e92d6b4ab9178 100644 (file)
@@ -67,6 +67,7 @@ exports[`should correctly handle a WS failure 1`] = `
                 "base": "master",
                 "branch": "feature/foo/bar",
                 "key": "1001",
+                "target": "master",
                 "title": "Foo Bar feature",
               }
             }
@@ -108,6 +109,7 @@ exports[`should correctly handle a WS failure 1`] = `
                 "base": "master",
                 "branch": "feature/foo/bar",
                 "key": "1001",
+                "target": "master",
                 "title": "Foo Bar feature",
               }
             }
@@ -153,6 +155,7 @@ exports[`should correctly handle a WS failure 1`] = `
                 "base": "master",
                 "branch": "feature/foo/bar",
                 "key": "1001",
+                "target": "master",
                 "title": "Foo Bar feature",
               }
             }
@@ -194,6 +197,7 @@ exports[`should correctly handle a WS failure 1`] = `
                 "base": "master",
                 "branch": "feature/foo/bar",
                 "key": "1001",
+                "target": "master",
                 "title": "Foo Bar feature",
               }
             }
@@ -239,6 +243,7 @@ exports[`should correctly handle a WS failure 1`] = `
                 "base": "master",
                 "branch": "feature/foo/bar",
                 "key": "1001",
+                "target": "master",
                 "title": "Foo Bar feature",
               }
             }
@@ -280,6 +285,7 @@ exports[`should correctly handle a WS failure 1`] = `
                 "base": "master",
                 "branch": "feature/foo/bar",
                 "key": "1001",
+                "target": "master",
                 "title": "Foo Bar feature",
               }
             }
@@ -325,6 +331,7 @@ exports[`should correctly handle a WS failure 1`] = `
                 "base": "master",
                 "branch": "feature/foo/bar",
                 "key": "1001",
+                "target": "master",
                 "title": "Foo Bar feature",
               }
             }
@@ -379,6 +386,7 @@ exports[`should correctly handle a WS failure 1`] = `
                 "base": "master",
                 "branch": "feature/foo/bar",
                 "key": "1001",
+                "target": "master",
                 "title": "Foo Bar feature",
               }
             }
@@ -485,6 +493,7 @@ exports[`should render correctly for a failed QG 1`] = `
             "base": "master",
             "branch": "feature/foo/bar",
             "key": "1001",
+            "target": "master",
             "title": "Foo Bar feature",
           }
         }
@@ -548,6 +557,7 @@ exports[`should render correctly for a failed QG 1`] = `
                 "base": "master",
                 "branch": "feature/foo/bar",
                 "key": "1001",
+                "target": "master",
                 "title": "Foo Bar feature",
               }
             }
@@ -628,6 +638,7 @@ exports[`should render correctly for a failed QG 1`] = `
                 "base": "master",
                 "branch": "feature/foo/bar",
                 "key": "1001",
+                "target": "master",
                 "title": "Foo Bar feature",
               }
             }
@@ -712,6 +723,7 @@ exports[`should render correctly for a failed QG 1`] = `
                 "base": "master",
                 "branch": "feature/foo/bar",
                 "key": "1001",
+                "target": "master",
                 "title": "Foo Bar feature",
               }
             }
@@ -792,6 +804,7 @@ exports[`should render correctly for a failed QG 1`] = `
                 "base": "master",
                 "branch": "feature/foo/bar",
                 "key": "1001",
+                "target": "master",
                 "title": "Foo Bar feature",
               }
             }
@@ -876,6 +889,7 @@ exports[`should render correctly for a failed QG 1`] = `
                 "base": "master",
                 "branch": "feature/foo/bar",
                 "key": "1001",
+                "target": "master",
                 "title": "Foo Bar feature",
               }
             }
@@ -956,6 +970,7 @@ exports[`should render correctly for a failed QG 1`] = `
                 "base": "master",
                 "branch": "feature/foo/bar",
                 "key": "1001",
+                "target": "master",
                 "title": "Foo Bar feature",
               }
             }
@@ -1040,6 +1055,7 @@ exports[`should render correctly for a failed QG 1`] = `
                 "base": "master",
                 "branch": "feature/foo/bar",
                 "key": "1001",
+                "target": "master",
                 "title": "Foo Bar feature",
               }
             }
@@ -1172,6 +1188,7 @@ exports[`should render correctly for a failed QG 1`] = `
                 "base": "master",
                 "branch": "feature/foo/bar",
                 "key": "1001",
+                "target": "master",
                 "title": "Foo Bar feature",
               }
             }
@@ -1363,6 +1380,7 @@ exports[`should render correctly for a passed QG 1`] = `
                 "base": "master",
                 "branch": "feature/foo/bar",
                 "key": "1001",
+                "target": "master",
                 "title": "Foo Bar feature",
               }
             }
@@ -1443,6 +1461,7 @@ exports[`should render correctly for a passed QG 1`] = `
                 "base": "master",
                 "branch": "feature/foo/bar",
                 "key": "1001",
+                "target": "master",
                 "title": "Foo Bar feature",
               }
             }
@@ -1527,6 +1546,7 @@ exports[`should render correctly for a passed QG 1`] = `
                 "base": "master",
                 "branch": "feature/foo/bar",
                 "key": "1001",
+                "target": "master",
                 "title": "Foo Bar feature",
               }
             }
@@ -1607,6 +1627,7 @@ exports[`should render correctly for a passed QG 1`] = `
                 "base": "master",
                 "branch": "feature/foo/bar",
                 "key": "1001",
+                "target": "master",
                 "title": "Foo Bar feature",
               }
             }
@@ -1691,6 +1712,7 @@ exports[`should render correctly for a passed QG 1`] = `
                 "base": "master",
                 "branch": "feature/foo/bar",
                 "key": "1001",
+                "target": "master",
                 "title": "Foo Bar feature",
               }
             }
@@ -1771,6 +1793,7 @@ exports[`should render correctly for a passed QG 1`] = `
                 "base": "master",
                 "branch": "feature/foo/bar",
                 "key": "1001",
+                "target": "master",
                 "title": "Foo Bar feature",
               }
             }
@@ -1855,6 +1878,7 @@ exports[`should render correctly for a passed QG 1`] = `
                 "base": "master",
                 "branch": "feature/foo/bar",
                 "key": "1001",
+                "target": "master",
                 "title": "Foo Bar feature",
               }
             }
@@ -1987,6 +2011,7 @@ exports[`should render correctly for a passed QG 1`] = `
                 "base": "master",
                 "branch": "feature/foo/bar",
                 "key": "1001",
+                "target": "master",
                 "title": "Foo Bar feature",
               }
             }
index 964a369e572c9e66d8c8974d9ca78288ec5811c4..0d8aa1065780e8d5db0507be45fde0b46c652526 100644 (file)
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
-/* eslint-disable import/first, import/order */
-jest.mock('../../../../api/settings', () => ({
-  getValues: jest.fn(() => Promise.resolve([]))
-}));
-
 import * as React from 'react';
 import { mount, shallow } from 'enzyme';
 import App from '../App';
+import { getValues } from '../../../../api/settings';
+import {
+  mockMainBranch,
+  mockLongLivingBranch,
+  mockShortLivingBranch,
+  mockPullRequest
+} from '../../../../helpers/testMocks';
 
-const getValues = require('../../../../api/settings').getValues as jest.Mock<any>;
+jest.mock('../../../../api/settings', () => ({
+  getValues: jest.fn(() => Promise.resolve([]))
+}));
 
 beforeEach(() => {
-  getValues.mockClear();
+  jest.clearAllMocks();
 });
 
 it('renders sorted list of branches', () => {
-  const branchLikes: [
-    T.MainBranch,
-    T.LongLivingBranch,
-    T.ShortLivingBranch,
-    T.PullRequest,
-    T.ShortLivingBranch
-  ] = [
-    { isMain: true, name: 'master' },
-    { isMain: false, name: 'branch-1.0', type: 'LONG' },
-    { isMain: false, mergeBranch: 'master', name: 'feature', type: 'SHORT' },
-    { base: 'master', branch: 'feature', key: '1234', title: 'Feature PR' },
-    {
-      isMain: false,
-      mergeBranch: 'foobar',
-      isOrphan: true,
-      name: 'feature',
-      type: 'SHORT'
-    }
+  const branchLikes = [
+    mockMainBranch(),
+    mockLongLivingBranch(),
+    mockShortLivingBranch(),
+    mockPullRequest(),
+    mockShortLivingBranch({ mergeBranch: 'foobar', name: 'feature', isOrphan: true })
   ];
   const wrapper = shallow(
     <App
index f81de7c2a2f54fb498f0bc800e0d6ae463c2fe5c..56cf1d127db649e7760f81fa58dc784a54828a8d 100644 (file)
@@ -21,23 +21,13 @@ import * as React from 'react';
 import { shallow } from 'enzyme';
 import BranchRow from '../BranchRow';
 import { click } from '../../../../helpers/testUtils';
+import { mockPullRequest, mockShortLivingBranch } from '../../../../helpers/testMocks';
 
 const mainBranch: T.MainBranch = { isMain: true, name: 'master' };
 
-const shortBranch: T.ShortLivingBranch = {
-  analysisDate: '2017-09-27T00:05:19+0000',
-  isMain: false,
-  name: 'feature',
-  mergeBranch: 'foo',
-  type: 'SHORT'
-};
+const shortBranch = mockShortLivingBranch();
 
-const pullRequest: T.PullRequest = {
-  base: 'master',
-  branch: 'feature',
-  key: '1234',
-  title: 'Feature PR'
-};
+const pullRequest = mockPullRequest();
 
 it('renders main branch', () => {
   expect(shallowRender(mainBranch)).toMatchSnapshot();
index c1c1ef571b0d586968f6004239cf4c1bcba1aa30..63ded5dcefffda27431fbf085ee1ea4a4236c974 100644 (file)
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
-/* eslint-disable import/first */
-jest.mock('../../../../api/branches', () => ({
-  deleteBranch: jest.fn(),
-  deletePullRequest: jest.fn()
-}));
-
 import * as React from 'react';
 import { shallow, ShallowWrapper } from 'enzyme';
 import DeleteBranchModal from '../DeleteBranchModal';
 import { submit, doAsync, click, waitAndUpdate } from '../../../../helpers/testUtils';
 import { deleteBranch, deletePullRequest } from '../../../../api/branches';
+import { mockShortLivingBranch, mockPullRequest } from '../../../../helpers/testMocks';
+
+jest.mock('../../../../api/branches', () => ({
+  deleteBranch: jest.fn(),
+  deletePullRequest: jest.fn()
+}));
 
-const branch: T.ShortLivingBranch = {
-  isMain: false,
-  name: 'feature',
-  mergeBranch: 'master',
-  type: 'SHORT'
-};
+const branch = mockShortLivingBranch();
 
 beforeEach(() => {
-  (deleteBranch as jest.Mock).mockClear();
-  (deletePullRequest as jest.Mock).mockClear();
+  jest.clearAllMocks();
 });
 
 it('renders', () => {
@@ -58,17 +52,12 @@ it('deletes branch', async () => {
   await waitAndUpdate(wrapper);
   expect(wrapper.state().loading).toBe(false);
   expect(onDelete).toBeCalled();
-  expect(deleteBranch).toBeCalledWith({ branch: 'feature', project: 'foo' });
+  expect(deleteBranch).toBeCalledWith({ branch: 'feature/foo', project: 'foo' });
 });
 
 it('deletes pull request', async () => {
   (deletePullRequest as jest.Mock).mockImplementationOnce(() => Promise.resolve());
-  const pullRequest: T.PullRequest = {
-    base: 'master',
-    branch: 'feature',
-    key: '1234',
-    title: 'Feature PR'
-  };
+  const pullRequest = mockPullRequest();
   const onDelete = jest.fn();
   const wrapper = shallowRender(pullRequest, onDelete);
 
@@ -77,7 +66,7 @@ it('deletes pull request', async () => {
   await waitAndUpdate(wrapper);
   expect(wrapper.state().loading).toBe(false);
   expect(onDelete).toBeCalled();
-  expect(deletePullRequest).toBeCalledWith({ project: 'foo', pullRequest: '1234' });
+  expect(deletePullRequest).toBeCalledWith({ project: 'foo', pullRequest: '1001' });
 });
 
 it('cancels', () => {
@@ -101,7 +90,7 @@ it('stops loading on WS error', async () => {
   await waitAndUpdate(wrapper);
   expect(wrapper.state().loading).toBe(false);
   expect(onDelete).not.toBeCalled();
-  expect(deleteBranch).toBeCalledWith({ branch: 'feature', project: 'foo' });
+  expect(deleteBranch).toBeCalledWith({ branch: 'feature/foo', project: 'foo' });
 });
 
 function shallowRender(
index c706d117447405264e0d3802b71a7c2944e26a62..94ea8832c739b0715d0ea83221ffc1ddc533ad4e 100644 (file)
@@ -82,6 +82,7 @@ exports[`renders sorted list of branches 1`] = `
         <BranchRow
           branchLike={
             Object {
+              "analysisDate": "2018-01-01",
               "isMain": true,
               "name": "master",
             }
@@ -93,10 +94,12 @@ exports[`renders sorted list of branches 1`] = `
         <BranchRow
           branchLike={
             Object {
+              "analysisDate": "2018-01-01",
               "base": "master",
-              "branch": "feature",
-              "key": "1234",
-              "title": "Feature PR",
+              "branch": "feature/foo/bar",
+              "key": "1001",
+              "target": "master",
+              "title": "Foo Bar feature",
             }
           }
           component="foo"
@@ -105,9 +108,10 @@ exports[`renders sorted list of branches 1`] = `
         <BranchRow
           branchLike={
             Object {
+              "analysisDate": "2018-01-01",
               "isMain": false,
               "mergeBranch": "master",
-              "name": "feature",
+              "name": "feature/foo",
               "type": "SHORT",
             }
           }
@@ -117,8 +121,9 @@ exports[`renders sorted list of branches 1`] = `
         <BranchRow
           branchLike={
             Object {
+              "analysisDate": "2018-01-01",
               "isMain": false,
-              "name": "branch-1.0",
+              "name": "branch-6.7",
               "type": "LONG",
             }
           }
@@ -144,6 +149,7 @@ exports[`renders sorted list of branches 1`] = `
         <BranchRow
           branchLike={
             Object {
+              "analysisDate": "2018-01-01",
               "isMain": false,
               "isOrphan": true,
               "mergeBranch": "foobar",
index 1a2b636607c3b8d9822954bfacf74f54c87bf5fb..800b10d0601c756381f324f86d344e9b078d04e8 100644 (file)
@@ -58,15 +58,17 @@ exports[`renders pull request 1`] = `
     <BranchIcon
       branchLike={
         Object {
+          "analysisDate": "2018-01-01",
           "base": "master",
-          "branch": "feature",
-          "key": "1234",
-          "title": "Feature PR",
+          "branch": "feature/foo/bar",
+          "key": "1001",
+          "target": "master",
+          "title": "Foo Bar feature",
         }
       }
       className="little-spacer-right big-spacer-left"
     />
-    1234 – Feature PR
+    1001 – Foo Bar feature
   </td>
   <td
     className="thin nowrap"
@@ -74,10 +76,12 @@ exports[`renders pull request 1`] = `
     <Connect(BranchStatus)
       branchLike={
         Object {
+          "analysisDate": "2018-01-01",
           "base": "master",
-          "branch": "feature",
-          "key": "1234",
-          "title": "Feature PR",
+          "branch": "feature/foo/bar",
+          "key": "1001",
+          "target": "master",
+          "title": "Foo Bar feature",
         }
       }
       component="foo"
@@ -85,7 +89,11 @@ exports[`renders pull request 1`] = `
   </td>
   <td
     className="thin nowrap text-right big-spacer-left"
-  />
+  >
+    <DateFromNow
+      date="2018-01-01"
+    />
+  </td>
   <td
     className="thin nowrap text-right"
   >
@@ -110,16 +118,16 @@ exports[`renders short-living branch 1`] = `
     <BranchIcon
       branchLike={
         Object {
-          "analysisDate": "2017-09-27T00:05:19+0000",
+          "analysisDate": "2018-01-01",
           "isMain": false,
-          "mergeBranch": "foo",
-          "name": "feature",
+          "mergeBranch": "master",
+          "name": "feature/foo",
           "type": "SHORT",
         }
       }
       className="little-spacer-right big-spacer-left"
     />
-    feature
+    feature/foo
   </td>
   <td
     className="thin nowrap"
@@ -127,10 +135,10 @@ exports[`renders short-living branch 1`] = `
     <Connect(BranchStatus)
       branchLike={
         Object {
-          "analysisDate": "2017-09-27T00:05:19+0000",
+          "analysisDate": "2018-01-01",
           "isMain": false,
-          "mergeBranch": "foo",
-          "name": "feature",
+          "mergeBranch": "master",
+          "name": "feature/foo",
           "type": "SHORT",
         }
       }
@@ -141,7 +149,7 @@ exports[`renders short-living branch 1`] = `
     className="thin nowrap text-right big-spacer-left"
   >
     <DateFromNow
-      date="2017-09-27T00:05:19+0000"
+      date="2018-01-01"
     />
   </td>
   <td
index 3864d0c38fd53328e04ee5ad8c4c3b884612ac9a..e2c69b2eeefb867bbaa4ae2cd969459ee0efcc65 100644 (file)
@@ -18,7 +18,7 @@ exports[`renders 1`] = `
     <div
       className="modal-body"
     >
-      branches.delete.are_you_sure.feature
+      branches.delete.are_you_sure.feature/foo
     </div>
     <footer
       className="modal-foot"
@@ -57,7 +57,7 @@ exports[`renders 2`] = `
     <div
       className="modal-body"
     >
-      branches.delete.are_you_sure.feature
+      branches.delete.are_you_sure.feature/foo
     </div>
     <footer
       className="modal-foot"
index 030f3b09e2d375fe797ad7d45157dee86e9d0ed9..3d52b4e8098d9c06f83063a19285d0662b1465d3 100644 (file)
@@ -303,6 +303,7 @@ export function mockPullRequest(overrides: Partial<T.PullRequest> = {}): T.PullR
     base: 'master',
     branch: 'feature/foo/bar',
     key: '1001',
+    target: 'master',
     title: 'Foo Bar feature',
     ...overrides
   };
@@ -416,7 +417,7 @@ export function mockShortLivingBranch(
   return {
     analysisDate: '2018-01-01',
     isMain: false,
-    name: 'release-1.0',
+    name: 'feature/foo',
     mergeBranch: 'master',
     type: 'SHORT',
     ...overrides
@@ -429,7 +430,7 @@ export function mockLongLivingBranch(
   return {
     analysisDate: '2018-01-01',
     isMain: false,
-    name: 'master',
+    name: 'branch-6.7',
     type: 'LONG',
     ...overrides
   };
index 783da7f4b8557e8feb5c3ddb6b0e3a0f8d991331..bac122e018e16ae6d602babd66a6108e760be477 100644 (file)
@@ -2987,7 +2987,7 @@ branches.search_for_branches=Search for branches...
 branches.pull_requests=Pull Requests
 branches.short_lived.quality_gate.description=The branch status is passed because there are no open issue. The remaining {0} issue(s) have been confirmed.
 branches.short_lived_branches=Short-lived branches
-branches.pull_request.for_merge_into_x_from_y=for merge into {base} from {branch}
+branches.pull_request.for_merge_into_x_from_y=for merge into {target} from {branch}
 branches.see_the_pr=See the PR
 branches.measures.new_coverage.help=Coverage on New Code. See {link} for details.
 branches.measures.new_coverage.missing=No coverage data for new code.