created(tests) created tests for person route

This commit is contained in:
Yusuf İpek
2021-07-25 09:39:38 +03:00
parent 2de9d3594a
commit f163269b9e
7 changed files with 359 additions and 14 deletions
+2 -2
View File
@@ -18,8 +18,8 @@ router.get("/:id", auth, validateObjectId, async (req, res) => {
});
router.get("/get/:name", auth, async (req, res) => {
const p = new RegExp(req.params.name, "i");
const person = await Person.find({ name: p });
const findName = new RegExp(req.params.name, "i");
const person = await Person.find({ name: findName });
if (person.length === 0)
return res.status(404).send("Person does not exist!");