Skip to content

Commit

Permalink
Testing ESLint
Browse files Browse the repository at this point in the history
  • Loading branch information
IRUMVAEmmanuel1 committed Apr 23, 2024
1 parent 6ed0a57 commit feb2082
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
npx lint-staged
npm run test
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"seed": "npx sequelize-cli db:seed:all",
"lint": "npx eslint .",
"lint:fix": "npx eslint --fix .",
"test": "cross-env NODE_ENV=test jest --detectOpenHandles --coverage"
"test": "cross-env NODE_ENV=test jest --detectOpenHandles --coverage",
"prepare": "husky"
},
"lint-staged": {
".ts": [
Expand All @@ -28,7 +29,7 @@
},
"husky": {
"hooks": {
"pre-commit": "npm run lint-staged"
"pre-commit": "npm run lint-staged && npm run test"
}
},
"author": "atlp",
Expand All @@ -54,6 +55,7 @@
"globals": "^15.0.0",
"jest": "^29.7.0",
"nodemon": "^3.1.0",
"pre-commit": "^1.2.2",
"prettier": "^3.2.5",
"sequelize-cli": "^6.6.2",
"supertest": "^6.3.4",
Expand All @@ -72,13 +74,13 @@
"dotenv": "^16.4.5",
"express": "^4.19.2",
"jsonwebtoken": "^9.0.2",
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"path": "^0.12.7",
"pg": "^8.11.5",
"pg-hstore": "^2.3.4",
"sequelize": "^6.37.2",
"swagger-ui-express": "^5.0.0",
"prettier": "3.2.5",
"lint-staged": "^15.2.2",
"husky": "^9.0.11"
"sequelize": "^6.37.2",
"swagger-ui-express": "^5.0.0"
}
}
4 changes: 3 additions & 1 deletion src/controllers/userControllers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import { createUserService, getUserByEmail } from "../services/user.service";

export const fetchAllUsers = async (req: Request, res: Response) => {
try {
const users = await userService.getAllUsers();
// const users = await userService.getAllUsers();

const users = await userService.getAllUsers()

if (users.length <= 0) {
return res.status(404).json({
Expand Down
22 changes: 11 additions & 11 deletions src/routes/userRoutes.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { Router } from "express";
import {
fetchAllUsers,
createUserController,
userLogin }
from "../controllers/userControllers";
import { Router } from "express"
import {
fetchAllUsers,
createUserController,
userLogin,
} from "../controllers/userControllers"

const userRoutes = Router();
const userRoutes = Router()

userRoutes.get("/", fetchAllUsers);
userRoutes.post('/login',userLogin);
userRoutes.post("/register", createUserController)
userRoutes.get("/", fetchAllUsers)
userRoutes.post("/login", userLogin)

userRoutes.post("/register", createUserController)

export default userRoutes;
export default userRoutes

0 comments on commit feb2082

Please sign in to comment.