vendredi 13 juillet 2018

Testing :id routes

How can I test routes with :id into it.

For example, we have suppose a route like this

Router.get('/:id/profile

Now, I want to do a test case, the example scenario I saw from someone's else code was that he was passing a string of numbers (probably user ID or something)

Being a total beginner who have been asked to test something, how can I find that string which I can send when testing something.

For example here

describe('Admin users API testing', () => {
    it('GET /admin/users/:id/activityLog', (done) => {
        request(URL)
            .get('/admin/users/5a82b1a61dab4b54fj01f212e/activityLog')
            .set('accept', '/application/json')

We are sending request to

it('GET /admin/users/:id/activityLog

Which then looks like this

 .get('/admin/users/5a82b1a61dab4b54fj01f212e/activityLog')

inside the above get request we have, something like this

5a82b1a61dab4b54fj01f212e

So my question is how do the person doing testing knows this?

Aucun commentaire:

Enregistrer un commentaire