Supertest request expect multiple responses -


i use supertest test http request should return multiple responses. i've been using supertest until case, i've tried:

agent.post("/route/with/multiple/responses")     .type('json')     .send({some: 'json'})     .expect((res) => {         expect(res.status).toequal(200);     })     .expect((res) => {         expect(res.status).toequal(200);     })     .expect((res) => {         expect(res.status).toequal(500);         cb();     }); 

this attempt sends post request never gets first "expect" (probably bad syntax on part), tried using supertest-as-promised:

agent.post("/route/with/multiple/responses")     .type('json')     .send({some: 'json')     .expect((res) => {         expect(res.status).toequal(200);     })     .topromise()     .then((res) => {         expect(res.status).toequal(200);     })     .then((res) => {         expect(res.status).toequal(500);         cb();     }); 

this 1 runs through cases 'res' object same object.

i'm stumped, how can supertest test route has multiple responses (is possible)?


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -