diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0fd420e..9b04a88 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,8 +1,7 @@ name: Build on: push: - branches: - - develop + branches: ['main', 'develop'] pull_request: types: [opened, synchronize, reopened] jobs: @@ -13,6 +12,10 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: Install dependencies + run: npm install + - name: Test and coverage + run: npm run test:coverage - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@master env: diff --git a/Dockerfile b/Dockerfile index b32c9da..8a1e3f8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM node:18-alpine WORKDIR /app COPY . . -RUN npm i +RUN npm i --ignore-scripts CMD ["npm", "start"] \ No newline at end of file diff --git a/README.md b/README.md index 79f19b8..1c342de 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Mastercard_open-banking-reference-application-australia&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=Mastercard_open-banking-reference-application-australia) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=Mastercard_open-banking-reference-application-australia&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=Mastercard_open-banking-reference-application-australia) [![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=Mastercard_open-banking-reference-application-australia&metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=Mastercard_open-banking-reference-application-australia) +[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=Mastercard_open-banking-reference-application-australia&metric=coverage)](https://sonarcloud.io/summary/new_code?id=Mastercard_open-banking-reference-application-australia) ## Table of Contents diff --git a/sonar-project.properties b/sonar-project.properties index 2eb41c4..547db88 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,14 +1,15 @@ +# Root project information sonar.projectKey=Mastercard_open-banking-reference-application-australia +sonar.projectName=open-banking-reference-application-australia +sonar.projectVersion=1.0 sonar.organization=mastercard +# Exclusions parameters +sonar.exclusions=Dockerfile,src/tests/**,public/** -# This is the name and version displayed in the SonarCloud UI. -#sonar.projectName=open-banking-reference-application-australia -#sonar.projectVersion=1.0 +# Test coverage parameters +sonar.javascript.lcov.reportPaths=./coverage/lcov.info +sonar.coverage.exclusions=src/**/*.ts,src/*.js,src/App.tsx,src/index.tsx,/*.js - -# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. -#sonar.sources=. - -# Encoding of the source code. Default is default system encoding -#sonar.sourceEncoding=UTF-8 \ No newline at end of file +# Duplication exclusion parameters +sonar.cpd.exclusions=src/components/Product/data/index.ts diff --git a/src/components/ConnectForm/ConnectForm.tsx b/src/components/ConnectForm/ConnectForm.tsx index 3aff5e8..8994c5c 100644 --- a/src/components/ConnectForm/ConnectForm.tsx +++ b/src/components/ConnectForm/ConnectForm.tsx @@ -296,7 +296,7 @@ export default function ConnectForm() { } } } catch (error: any) { - console.error(error?.message); + console.log(error?.message); throw error; } }; @@ -645,7 +645,7 @@ export default function ConnectForm() { {accord.id === 'panel0' && AUTO_CREATE_CUSTOMER - ? 'AUTO COMPLETE' + ? 'AUTO CREATION COMPLETE' : 'COMPLETE'} ) diff --git a/src/components/SandBoxTip/SandBoxTip.tsx b/src/components/SandBoxTip/SandBoxTip.tsx index 3ff6fbf..e1cc5a0 100644 --- a/src/components/SandBoxTip/SandBoxTip.tsx +++ b/src/components/SandBoxTip/SandBoxTip.tsx @@ -36,10 +36,10 @@ export default function SandBoxTip() {
- {data.text.passwordField} + Banking Password - {data.text.passwordValue} + profile_4100
diff --git a/src/components/SandBoxTip/data/index.ts b/src/components/SandBoxTip/data/index.ts index 77c3e10..a1237fd 100644 --- a/src/components/SandBoxTip/data/index.ts +++ b/src/components/SandBoxTip/data/index.ts @@ -3,8 +3,6 @@ const data = { tip: ' Please select Finbank Aus OAuth and use the following username and password.', usernameField: 'User ID', usernameValue: 'profile_4100', - passwordField: 'Banking Password', - passwordValue: 'profile_4100', }, }; diff --git a/src/tests/ConnectForm.test.tsx b/src/tests/ConnectForm.test.tsx index 8ea00a1..cc9bb03 100644 --- a/src/tests/ConnectForm.test.tsx +++ b/src/tests/ConnectForm.test.tsx @@ -84,7 +84,7 @@ describe('Testing ConnectForm Component', () => { ); await user.click(screen.getByRole('button', { name: /View demo/i })); - const element = await screen.findByText(/AUTO COMPLETE/i); + const element = await screen.findByText(/AUTO CREATION COMPLETE/i); expect(element).toBeInTheDocument(); const connectElement = await screen.findByText('Connect Bank Account'); expect(connectElement).toBeInTheDocument(); diff --git a/src/tests/ExternalIcon.test.tsx b/src/tests/ExternalIcon.test.tsx new file mode 100644 index 0000000..da0478d --- /dev/null +++ b/src/tests/ExternalIcon.test.tsx @@ -0,0 +1,16 @@ +import { render } from '@testing-library/react'; +import { ExternalIcon } from '../components'; + +describe('Testing ExternalIcon component', () => { + test('Should render ExternalIcon', () => { + render( + ( + + ) as React.ReactElement + ); + }); + + test('Should render ExternalIcon - 2', () => { + render(() as React.ReactElement); + }); +});