Skip to content

Commit dd4237c

Browse files
Fix backend tests, remove ts-node
1 parent fd8aef9 commit dd4237c

3 files changed

Lines changed: 35 additions & 60 deletions

File tree

package-lock.json

Lines changed: 32 additions & 56 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@
8181
"nodemon": "^3.0.1",
8282
"sass-lint": "^1.13.1",
8383
"supertest": "^6.3.3",
84-
"ts-jest": "^29.0.5",
85-
"ts-node": "~8.3.0",
84+
"ts-jest": "^29.1.1",
8685
"typescript": "~5.2.2"
8786
}
8887
}

server/controllers/base.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ abstract class BaseCtrl {
1717
// Count all
1818
count = async (req: Request, res: Response) => {
1919
try {
20-
const count = await this.model.count();
20+
const count = await this.model.countDocuments();
2121
return res.status(200).json(count);
2222
} catch (err: any) {
2323
return res.status(400).json({ error: err.message });
@@ -57,7 +57,7 @@ abstract class BaseCtrl {
5757
// Delete by id
5858
delete = async (req: Request, res: Response) => {
5959
try {
60-
await this.model.findOneAndRemove({ _id: req.params.id });
60+
await this.model.findOneAndDelete({ _id: req.params.id });
6161
return res.sendStatus(200);
6262
} catch (err: any) {
6363
return res.status(400).json({ error: err.message });

0 commit comments

Comments
 (0)