API Testing With Supertest Guide
API Testing With Supertest Guide
Guide
Check those videos. First one is related to supertest, other one is really important
as your properly working test would manipulate the filesystem so you would need
to set up a mock database.
https://www.youtube.com/watch?v=FKnzS_icp20
https://www.youtube.com/watch?v=IDjF6-s1hGk
"jest": {
"testEnvironment": "node",
"coveragePathIgnorePatterns": [
"/node_modules/"
]
},
"test": "jest"
app.js
app.use(express.json());
postFiles.forEach((file) => {
try {
const postFilePath = path.join(__dirname, file);
module.exports = app;
server.js
app.test.js
npm test