Skip to content

Commit cdc69bb

Browse files
Added unit test
Co-authored-by: SrinivasanTarget <[email protected]>
1 parent a7ef578 commit cdc69bb

File tree

8 files changed

+10581
-7060
lines changed

8 files changed

+10581
-7060
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Code Quality Checks
1+
name: Code Quality and Tests
22

33
on:
44
push:
@@ -7,16 +7,16 @@ on:
77
branches: [ main ]
88

99
jobs:
10-
lint-and-format:
11-
name: ESLint and Prettier Check
10+
lint-format-and-test:
11+
name: ESLint, Prettier, and Tests
1212
runs-on: ubuntu-latest
1313

1414
steps:
1515
- name: Checkout code
16-
uses: actions/checkout@v3
16+
uses: actions/checkout@v4
1717

1818
- name: Setup Node.js
19-
uses: actions/setup-node@v3
19+
uses: actions/setup-node@v4
2020
with:
2121
node-version: '18'
2222
cache: 'npm'
@@ -29,3 +29,6 @@ jobs:
2929

3030
- name: Run Prettier check
3131
run: npm run format:check
32+
33+
- name: Run Locator Tests
34+
run: npm run test:locators

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ This project uses ESLint for linting and Prettier for code formatting.
1515
- `npm run format` - Format all code using Prettier
1616
- `npm run format:check` - Check if code is properly formatted
1717
- `npm run check` - Run both linting and format checking
18+
- `npm test` - Run all tests
19+
- `npm run test:locators` - Run tests for locator generation functionality
1820

1921
#### Configuration
2022

@@ -28,9 +30,21 @@ Before committing code, run:
2830

2931
```bash
3032
npm run check
33+
npm test
3134
```
3235

33-
This will ensure your code passes both linting and formatting checks.
36+
This will ensure your code passes linting, formatting checks, and all tests.
37+
38+
### Testing
39+
40+
This project uses Jest for unit testing. Tests are located in the `src/tests` directory.
41+
42+
#### Running Tests
43+
44+
- `npm test` - Run all tests
45+
- `npm run test:locators` - Run tests for locator generation functionality
46+
47+
For more details about the testing approach and how to add new tests, see [src/tests/README.md](src/tests/README.md).
3448

3549
## Build and Run
3650

jest.config.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
export default {
2+
preset: 'ts-jest',
3+
testEnvironment: 'node',
4+
extensionsToTreatAsEsm: ['.ts'],
5+
moduleNameMapper: {
6+
'^(\\.{1,2}/.*)\\.js$': '$1',
7+
},
8+
transform: {
9+
'^.+\\.tsx?$': [
10+
'ts-jest',
11+
{
12+
useESM: true,
13+
},
14+
],
15+
},
16+
};

0 commit comments

Comments
 (0)