Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e989ab7
Updated the actions node version
dheeraj1429 Sep 20, 2025
c84a6bb
Added otp input test cases
dheeraj1429 Sep 20, 2025
025c253
[workflow/test] Added sonar check
dheeraj1429 Sep 20, 2025
05f2687
[workflow/test] Working on test cases
dheeraj1429 Sep 20, 2025
8bd0331
[workflow/test] remove unused test cases
dheeraj1429 Sep 20, 2025
878782b
[workflow/test] Added lint workflow
dheeraj1429 Sep 20, 2025
7b98450
[workflow/test] updated workflow
dheeraj1429 Sep 20, 2025
915ffd1
[workflow/test] Added eslint config =
dheeraj1429 Sep 20, 2025
8c8bf38
[workflow/test] Added sonar config
dheeraj1429 Sep 20, 2025
3786b18
[workflow/test] updated sonar qube config
dheeraj1429 Sep 20, 2025
3dc99c8
[workflow/test] Updated the jest config file for testing
dheeraj1429 Sep 20, 2025
a270b6d
[workflow/test] Updated the sonar config
dheeraj1429 Sep 20, 2025
3634199
[workflow/test] Updated the sonar config
dheeraj1429 Sep 20, 2025
fdca890
[workflow/test] Updated jest config
dheeraj1429 Sep 20, 2025
99e291d
[workflow/test] Updated test cases
dheeraj1429 Sep 21, 2025
88ec77d
[workflow/test] Added test runner yaml file
dheeraj1429 Sep 21, 2025
096b621
[workflow/test] added type check actions
dheeraj1429 Sep 21, 2025
7664618
[workflow/test] Fixed the types, Added code check action
dheeraj1429 Sep 21, 2025
3d0b3f0
[workflow/test] Updated the typescript and workflows
dheeraj1429 Sep 21, 2025
f6ff367
[workflow/test] updated the ts file
dheeraj1429 Sep 21, 2025
4b61b27
[workflow/test] Updated ts config file
dheeraj1429 Sep 21, 2025
f4de948
[workflow/test] Updated sonar config
dheeraj1429 Sep 21, 2025
50708f0
[workflow/test] Updated sonar config
dheeraj1429 Sep 21, 2025
5c7e54c
[workflow/test] Updated sonar config
dheeraj1429 Sep 21, 2025
e542884
[workflow/test] Fixing the sonar issue
dheeraj1429 Sep 21, 2025
3e11807
[workflow/test] Fixing the sonar issues
dheeraj1429 Sep 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules/
examples/
__test__/

.github
coverage/
23 changes: 22 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
module.exports = {
root: true,
extends: '@react-native',
extends: ['@react-native', 'plugin:testing-library/react'],
ignorePatterns: ['.eslintrc.js', '**/*.config.js', '**/*.setup.ts'],
env: { jest: true },
parserOptions: {
sourceType: 'module',
useJSXTextNode: true,
tsconfigRootDir: __dirname,
project: './tsconfig.json',
},
plugins: ['unused-imports'],
overrides: [
{
files: ['src/**/*.{ts,tsx,js,jsx}'],
rules: {
'object-curly-spacing': ['error', 'always'],
'unused-imports/no-unused-imports': 'error',
complexity: ['error', 8],
'import/extensions': 0,
'react/jsx-filename-extension': [2, { extensions: ['.tsx'] }],
},
},
],
};
10 changes: 9 additions & 1 deletion .github/actions/install-dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,17 @@ runs:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 22.9.0
node-version: 20
cache: 'yarn'

- name: Cache node modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-

- name: Install dependencies
run: yarn install
shell: bash
8 changes: 5 additions & 3 deletions .github/workflows/code-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run unit tests
run: yarn run test --coverage --forceExit --maxWorkers=2
continue-on-error: false
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
30 changes: 30 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: "CodeQL Analysis"

on:
push:
branches: [ main ]
pull_request:
branches:
- master
schedule:
- cron: '0 0 * * 0'

jobs:
codeql:
name: Analyze
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: typescript, javascript

- name: Autobuild
uses: github/codeql-action/autobuild@v3

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
26 changes: 26 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Lint
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]

jobs:
eslint:
name: "Eslint check"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install dependencies
uses: ./.github/actions/install-dependencies
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run ESLint
run: yarn run lint
continue-on-error: false
24 changes: 24 additions & 0 deletions .github/workflows/test-runner.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Test
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
code-quality-check:
name: Test Runner
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install dependencies
uses: ./.github/actions/install-dependencies
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run unit tests
run: yarn run test --coverage --forceExit --maxWorkers=2
continue-on-error: false
23 changes: 23 additions & 0 deletions .github/workflows/type-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: TSC
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
code-quality-check:
name: Type Check
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install dependencies
uses: ./.github/actions/install-dependencies
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run TypeScript type check
run: npx tsc --noEmit
continue-on-error: false
4 changes: 3 additions & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
module.exports = {
arrowParens: 'avoid',
bracketSameLine: true,
bracketSpacing: false,
bracketSpacing: true,
singleQuote: true,
trailingComma: 'all',
tabWidth: 2,
printWidth: 130,
};
5 changes: 5 additions & 0 deletions .sonarlint/Ffi_staticLib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"sonarCloudOrganization": "material-elements",
"projectKey": "material-elements_react-native-material-elements",
"region": "EU"
}
6 changes: 5 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"cSpell.words": ["Cocoapods"]
"cSpell.words": ["Cocoapods"],
"sonarlint.connectedMode.project": {
"connectionId": "material-elements",
"projectKey": "material-elements_react-native-material-elements"
}
}
7 changes: 2 additions & 5 deletions App.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import React from 'react';
import {SafeAreaView, ScrollView} from 'react-native';
import {
Container,
ThemeProvider,
} from './src/packages/react-native-material-elements';
import { SafeAreaView, ScrollView } from 'react-native';
import { Container, ThemeProvider } from './src/packages/react-native-material-elements';

function App(): React.JSX.Element {
return (
Expand Down
10 changes: 0 additions & 10 deletions Component.tsx

This file was deleted.

4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* @format
*/

import {AppRegistry} from 'react-native';
import { AppRegistry } from 'react-native';
import App from './App';
import {name as appName} from './app.json';
import { name as appName } from './app.json';

AppRegistry.registerComponent(appName, () => App);
19 changes: 6 additions & 13 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,24 @@ module.exports = {
'.enum.ts',
'/config/',
'/coverage/',
'.eslintrc.js',
'.prettierrc.js',
'babel.config.js',
],

coverageReporters: ['html', 'text', 'lcov', 'text-summary'],

moduleFileExtensions: [
'ts',
'tsx',
'js',
'jsx',
'json',
'node',
'mjs',
'svg',
'png',
],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node', 'mjs', 'svg', 'png'],
testEnvironment: 'node',

setupFiles: ['./jest.setup.ts'],

coverageThreshold: {
global: {
branches: 80,
statements: 80,
branches: 75,
functions: 80,
lines: 80,
statements: 80,
},
},
};
2 changes: 1 addition & 1 deletion metro.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');

/**
* Metro configuration
Expand Down
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,11 @@
"test": "jest --coverage"
},
"dependencies": {
"@hookform/resolvers": "^5.1.1",
"@testing-library/react-native": "^12.9.0",
"lodash": "^4.17.21",
"react": "18.3.1",
"react-hook-form": "^7.58.0",
"react-native": "0.76.3",
"react-native-phone-number-input": "^2.1.0",
"react-native-vector-icons": "^10.2.0",
"use-context-selector": "^2.0.0",
"yup": "^1.6.1"
"use-context-selector": "^2.0.0"
},
"devDependencies": {
"@babel/core": "^7.25.2",
Expand All @@ -33,13 +28,16 @@
"@react-native/metro-config": "0.76.3",
"@react-native/typescript-config": "0.76.3",
"@testing-library/react-hooks": "^8.0.1",
"@testing-library/react-native": "^12.9.0",
"@types/jest": "^29.5.14",
"@types/lodash": "^4.17.13",
"@types/react": "^18.2.6",
"@types/react-native-vector-icons": "^6.4.18",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.6.3",
"eslint": "^8.19.0",
"eslint-plugin-testing-library": "^7.8.0",
"eslint-plugin-unused-imports": "^4.2.0",
"jest": "^29.6.3",
"prettier": "2.8.8",
"react-test-renderer": "18.2.0",
Expand Down
11 changes: 11 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
sonar.projectKey=material-elements_react-native-material-elements
sonar.organization=material-elements

sonar.sources=src

sonar.exclusions=**/node_modules/**, **/*.test.ts, **/*.spec.ts, **/__test__/**, **/examples/**, **/**.styles.ts

sonar.javascript.file.suffixes=.js,.jsx
sonar.typescript.file.suffixes=.ts,.tsx

sonar.javascript.lcov.reportPaths=coverage/lcov.info
9 changes: 0 additions & 9 deletions src/packages/react-native-material-elements/.prettierrc.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,12 @@ describe('Base button component', () => {
expect(mockOnPress).toHaveBeenCalled();
expect(mockOnPress).toHaveBeenCalledTimes(1);
});

it('should called the onLongPress function', () => {
jest.useFakeTimers();
const { getByTestId } = render(<BaseButton onLongPress={mockOnLongPress} testID={mockTestId} />);
const button = getByTestId(mockTestId);
fireEvent(button, 'longPress', { nativeEvent: {} });
expect(mockOnLongPress).toHaveBeenCalled();
});
});
Loading
Loading