How to convert below code with mock data? Below is the testing code of NodeJs post call api.
const request = require('supertest') const app = require('../server') describe('Post Endpoints', () => { it('should create a new post', async () => { const res = await request(app) .post('/api/posts') .send({ userId: 1, title: 'test is cool', }) expect(res.statusCode).toEqual(201) expect(res.body).toHaveProperty('post') }) })
1.4m articles
1.4m replys
5 comments
57.0k users