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 ab04ada
Show file tree
Hide file tree
Showing 8 changed files with 5,488 additions and 1,657 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yml → .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ jobs:
run: npm install

- name: Running test
run: npm run test

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 }}
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

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)
[![codecov](https://codecov.io/gh/atlp-rwanda/eagles-ec-fe/graph/badge.svg?token=MZAXZNVDXC)](https://codecov.io/gh/atlp-rwanda/eagles-ec-fe)

## 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 +30,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 ab04ada

Please sign in to comment.