Skip to content

Commit

Permalink
[finishes 187511688]-implement-badges-status(CI/CD)-show-whether-pass…
Browse files Browse the repository at this point in the history
…ed-or-failed
  • Loading branch information
hozayves committed Apr 30, 2024
1 parent c9bbce0 commit 169062f
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
service_name: "github"
repo_token: $COVERALLS_REPO_TOKEN
6 changes: 5 additions & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ jobs:
- name: NPM install, build and test
run: |
npm install
npm test
npm test --coverage
env:
DB_USER: ${{ secrets.DEV_DB_USER }}
DB_PASSWORD: ${{ secrets.DEV_DB_PASSWORD }}
DB_HOST: ${{ secrets.DEV_DB_HOST }}
- name: Send Coverage to Coveralls
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.COVERALLS_REPO_TOKEN }}

build:
name: Build
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
[![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com)
[![.github/workflows/main.yaml](https://github.com/atlp-rwanda/e-commerce-mavericcks-bn/actions/workflows/main.yaml/badge.svg)](https://github.com/atlp-rwanda/e-commerce-mavericcks-bn/actions/workflows/main.yaml)
[![Coverage Status](https://coveralls.io/repos/github/atlp-rwanda/e-commerce-mavericcks-bn/badge.svg?branch=187511688-Implement-Badges-for-the-Project-Repository)](https://github.com/atlp-rwanda/e-commerce-mavericcks-bn.git) [![Version](https://img.shields.io/badge/version-1.0.0-blue)](https://github.com/your-username/your-repo-name/releases/tag/v1.0.0)


![NodeJS](https://img.shields.io/badge/node.js-6DA55F?style=for-the-badge&logo=node.js&logoColor=white) ![Express.js](https://img.shields.io/badge/express.js-%23404d59.svg?style=for-the-badge&logo=express&logoColor=%2361DAFB) ![Static Badge](https://img.shields.io/badge/Sequelize-blue?style=for-the-badge&logo=nodedotjs&logoColor=white) ![Static Badge](https://img.shields.io/badge/Docker-%23095CB0?style=for-the-badge&logo=docker&logoColor=white) ![Static Badge](https://img.shields.io/badge/Typescript-%234A5561?style=for-the-badge&logo=typescript&logoColor=white)





# e-commerce-mavericcks-bn

Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"dev": "cross-env NODE_ENV=development nodemon src/server.ts",
"start": "cross-env NODE_ENV=production node dist/src/server.js",
"test": "cross-env NODE_ENV=test jest --coverage",
"coveralls": "cat ./coverage/lcov.info | node node_modules/.bin/coveralls",
"lint": "eslint --ignore-path .eslintignore \"**/*.{js,ts}\"",
"format": "prettier --ignore-path .gitignore --write \"**/*.+(js|ts|json)\"",
"prepare": "husky install && npx husky add .husky/pre-commit \"npx lint-staged\"",
Expand Down Expand Up @@ -69,6 +70,7 @@
"@typescript-eslint/eslint-plugin": "^7.7.0",
"@typescript-eslint/parser": "^7.7.0",
"babel-jest": "^29.7.0",
"coveralls": "^3.1.1",
"cross-env": "^7.0.3",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
Expand Down
3 changes: 3 additions & 0 deletions src/controllers/add.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function addition(a: number, b: number) {
return a + b;
}
23 changes: 23 additions & 0 deletions src/test/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
import { addition } from '../controllers/add';

test('Adding 2 and 1 equals 3', () => {
expect(2 + 1).toBe(3);
});
test('Display name Hello World!', () => {
const name = 'Hello World!';
expect(name).toBe('Hello World!');
});

test('Addition function adds two numbers correctly', () => {
// Test case 1: Testing addition of positive numbers
expect(addition(2, 3)).toBe(5); // Expected result: 2 + 3 = 5

// Test case 2: Testing addition of negative numbers
expect(addition(-2, -3)).toBe(-5); // Expected result: -2 + (-3) = -5

// Test case 3: Testing addition of a positive and a negative number
expect(addition(5, -3)).toBe(2); // Expected result: 5 + (-3) = 2

// Test case 4: Testing addition of zero and a number
expect(addition(0, 7)).toBe(7); // Expected result: 0 + 7 = 7

// Test case 5: Testing addition of a number and zero
expect(addition(4, 0)).toBe(4); // Expected result: 4 + 0 = 4
});

0 comments on commit 169062f

Please sign in to comment.