Skip to content
Advertisement

Tag: supertest

How to store response body in supertest?

I am testing very basic REST api with supertest. I want to save the item id received in response body and assign it to a variable. Using this id i want to make further tests like get-item-by-id or update-item-by-id. No official documentation has covered this so a beginner friendly answer would be very helpful. test i have written Answer Use

Start and stop server with supertest

I have the following server class : I’m using supertest for end-to-end testing. I wish to start my application beforeAll tests and stop it when the tests are done. It’s easy to do that using beforAll and afterAll where I can just once instanciate the Server class and call the start and close methods. But as I have 10+ controllers

Advertisement