Skip to content

Commit 429cab8

Browse files
committed
added test structure and setup
1 parent 36a47f6 commit 429cab8

File tree

6 files changed

+3
-1
lines changed

6 files changed

+3
-1
lines changed

controllers/blog-post.controller.js

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ const postBlogpost = async (req, res, next) => {
99
const {user, content} = req.body
1010
try {
1111
await createBlogpost(user, content)
12+
// other service call (or same service, different function can go here)
13+
// i.e. - await generateBlogpostPreview()
1214
res.sendStatus(201)
1315
next()
1416
} catch(e) {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"main": "app.js",
66
"scripts": {
77
"start": "nodemon app.js",
8-
"test": "echo \"Error: no test specified\" && exit 1"
8+
"test": "mocha ./tests/**/*.test.js"
99
},
1010
"repository": {
1111
"type": "git",

tests/controllers/blog-post.controller.test.js

Whitespace-only changes.

tests/db/blog-post.db.test.js

Whitespace-only changes.

tests/services/blog-post.services.test.js

Whitespace-only changes.

tests/utils/utils.test.js

Whitespace-only changes.

0 commit comments

Comments
 (0)