From ccf836d2de4bfba561571fb263433c7bdadd2b9f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gr=C3=A9goire=20Aubert?= Date: Fri, 3 Aug 2018 15:23:27 +0200 Subject: [PATCH] Fix quality flaws --- .../src/main/ts/components/Config.tsx | 6 +++--- .../src/main/ts/components/__tests__/Config-test.tsx | 8 ++++---- .../__tests__/__snapshots__/Config-test.tsx.snap | 7 ++++--- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/server/sonar-bitbucketcloud/src/main/ts/components/Config.tsx b/server/sonar-bitbucketcloud/src/main/ts/components/Config.tsx index d8818f58ac3..eac079cbdcd 100644 --- a/server/sonar-bitbucketcloud/src/main/ts/components/Config.tsx +++ b/server/sonar-bitbucketcloud/src/main/ts/components/Config.tsx @@ -198,7 +198,7 @@ export default class Config extends React.PureComponent { descriptionComponent = ( <> This repository is already bound to a{' '} - - Analyse a project + + Create a project

diff --git a/server/sonar-bitbucketcloud/src/main/ts/components/__tests__/Config-test.tsx b/server/sonar-bitbucketcloud/src/main/ts/components/__tests__/Config-test.tsx index 0dee0434d1e..886013dafd6 100644 --- a/server/sonar-bitbucketcloud/src/main/ts/components/__tests__/Config-test.tsx +++ b/server/sonar-bitbucketcloud/src/main/ts/components/__tests__/Config-test.tsx @@ -25,7 +25,7 @@ import { isManualBindingAllowed } from '../../utils'; jest.mock('../../utils', () => ({ displayMessage: jest.fn(), - isManualBindingAllowed: jest.fn(() => true) + isManualBindingAllowed: jest.fn() })); jest.mock('../../api', () => ({ @@ -48,6 +48,8 @@ const CONTEXT = { jwt: '' }; beforeEach(() => { (bindProject as jest.Mock).mockClear(); (getMyProjects as jest.Mock).mockClear(); + (isManualBindingAllowed as jest.Mock).mockClear(); + (isManualBindingAllowed as jest.Mock).mockReturnValue(true); }); it('should display correctly', async () => { @@ -62,14 +64,12 @@ it('should display correctly', async () => { it('should display correctly for auto binding', () => { (isManualBindingAllowed as jest.Mock).mockReturnValue(false); - expect(getWrapper()).toMatchSnapshot(); - (isManualBindingAllowed as jest.Mock).mockReturnValue(true); + expect(getWrapper({ projectKey: undefined })).toMatchSnapshot(); }); it('should display correctly for auto binding with already a projectKey', () => { (isManualBindingAllowed as jest.Mock).mockReturnValue(false); expect(getWrapper()).toMatchSnapshot(); - (isManualBindingAllowed as jest.Mock).mockReturnValue(true); }); it('should display the authentication component and the display checkbox', async () => { diff --git a/server/sonar-bitbucketcloud/src/main/ts/components/__tests__/__snapshots__/Config-test.tsx.snap b/server/sonar-bitbucketcloud/src/main/ts/components/__tests__/__snapshots__/Config-test.tsx.snap index 1667e404154..032abbe0401 100644 --- a/server/sonar-bitbucketcloud/src/main/ts/components/__tests__/__snapshots__/Config-test.tsx.snap +++ b/server/sonar-bitbucketcloud/src/main/ts/components/__tests__/__snapshots__/Config-test.tsx.snap @@ -254,13 +254,14 @@ exports[`should display correctly for auto binding 1`] = ` className="settings-description" > - This repository is already bound to a + To display the quality of your repository, you have to - SonarCloud project + provision + a project on SonarCloud and trigger an analysis.

-- 2.39.5