goldbergyoni / goldbergyoni/nodejs-testing-best-practices

How to test if a delete request actually deletes the resource

Open
#4 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
4.4k
Forks
288
PR merge metrics
No merged PRs in 30d

Description

We have a user which has a few comments.
When we delete the user, we should delete all its comments as well.
How can we test that the **comments** get deleted?
We can't do this through an API because the user doesn't exist anymore and:
```
GET /api/users/3/comments
```
Will return `404` error code because user `3` doesn't exist and not because user has 0 comments.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.