Here is my http post
call
app.post('/sample', (req, res) => {
res.status(200).send({
x:1,y:2
});
})
I would like to test the response contains the properties and x
and y
Here is the test code but it checks only the response ok or not.
describe('Test the post path', () => {
test('It should response the POST method', () => {
return request(app).post('/sample').expect(200);
});
})
I think this method expect.objectContaining(object)
fulfill my needs but don't know how to use in my scenario
Aucun commentaire:
Enregistrer un commentaire