Skip to content

Commit

Permalink
chore(test setup):setup test with jest library
Browse files Browse the repository at this point in the history
-ensure jest is configured to test components
-ensure all command needed to run test are provided in readMe file

[Delivers #187419110]
  • Loading branch information
niyobertin committed Jun 8, 2024
1 parent 12b68b9 commit 709c53a
Show file tree
Hide file tree
Showing 8 changed files with 5,487 additions and 1,655 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/main.yml → .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ jobs:

- name: Running test
run: npm run test
- name: Running test coverage
run: npm run test --coverage

- name: Build application
run: npm run build

- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
token: ${{ secrets.CODECOV_TOKEN }}
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

The front-end of Eagle E-commerce utilizes React for a modern, user-friendly interface, while Node.js powers its backend, ensuring a seamless shopping experience

[![Maintainability](https://api.codeclimate.com/v1/badges/81fa30232b27b1482f4f/maintainability)](https://codeclimate.com/github/atlp-rwanda/eagles-ec-fe/maintainability)
![Github Actions](https://github.com/atlp-rwanda/eagles-ec-fe/actions/workflows/deploy.yml/badge.svg)

## Tech Stack

This project was built using the PERN (PostgreSQL, Express.js, React.js, Node.js) stack, additionally with Vite and Typescript.
Expand All @@ -26,3 +29,18 @@ npm install
```bash
npm run dev
```
## How to run test

1. **Run unit test:**
```bash
npm run test
```
2. **Tun test in watch mode
```bash
npm run test:watch
```
3. **Generate test coverage
```bash
npm run test:coverage
```
Write your test by creating a file with .test.tsx extetion under __test__ directory.
10 changes: 10 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export default {
preset: 'ts-jest',
testEnvironment: 'jest-environment-jsdom',
transform: {
"^.+\\.tsx?$": "ts-jest"
},
moduleNameMapper: {
'\\.(gif|ttf|eot|svg|png)$': '<rootDir>/test/__ mocks __/fileMock.js',
},
}
Loading

0 comments on commit 709c53a

Please sign in to comment.