Skip to content

Commit

Permalink
feat(user-Test): implementing sign up using jest
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuyisenge2 committed Apr 22, 2024
1 parent d475312 commit c25b0bb
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 14 deletions.
43 changes: 30 additions & 13 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
# This workflow will install node dependencies, run tests and report coverage
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: build

on:
push:
branches:
- feat-test-CI-implementation-187419042
- "*"
- develop

- "*"
pull_request:
branches:
- develop
- "*"

jobs:
test:
Expand All @@ -22,6 +20,11 @@ jobs:
DB_TEST_URL: ${{ secrets.DB_TEST_URL }}
DEV_MODE: ${{ secrets.DEV_MODE }}
DB_HOSTED_MODE: ${{ secrets.DB_HOSTED_MODE }}
ACCESS_TOKEN_SECRET: ${{ secrets.ACCESS_TOKEN_SECRET }}
SESSION_SECRET: ${{ secrets.SESSION_SECRET }}
JWT_SECRET: ${{ secrets.JWT_SECRET }}
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}

strategy:
matrix:
Expand All @@ -37,15 +40,29 @@ jobs:
- name: Install dependencies
run: npm install

- name: Run tests
run: npm run test

- name: Run tests and build test coverage
run: npm run test:ci

- name: Test & publish code climate coverage
uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageCommand: npm run test:ci
debug: true
coverageLocations: |
${{github.workspace}}/*.lcov:lcov
- name: Setup Code Climate test-reporter
run: |
# Download test reporter as a static binary
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build
- name: Run tests
run: npm run test

- name: Store coverage report
if: always()
run: mkdir -p coverage


- name: Send coverage report to Code Climate
if: always()
run: ./cc-test-reporter after-build -t lcov -p coverage

- name: coveralls
run: npx coveralls < coverage/lcov.info
2 changes: 1 addition & 1 deletion src/controllers/userController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const registerUser = async (
} catch (error) {
res
.status(500)
.json(new HttpException("SERVER FAIL", "Something went wrong!"));
.json(new HttpException("SERVER FAILS", "Something went wrong!"));
}
};

Expand Down

0 comments on commit c25b0bb

Please sign in to comment.