supertest Questions

4

I'm passing my authentication token via an HTTP-Only cookie in my NestJS API. As such, when writing some E2E tests for my Auth endpoints, I'm having an issue with cookies not being where I expect ...
Hygroscopic asked 1/2, 2020 at 17:35

3

I have been trying for several hours to test an endpoint of my rest api with Jest, Supertest and Express. This endpoint is protected by an authentication middleware named "advancedAuthGuard&qu...
Bushire asked 29/8, 2022 at 0:28

11

Solved

I am doing a basic end to end testing here, for the moment it's failing, but first I can't get rid of the open handle. Ran all test suites. Jest has detected the following 1 open handle potentiall...
Bartholomeus asked 19/7, 2021 at 8:57

2

I just started to learn do test with supertest and mocha. I've read the api document of supertest and it said that supertest support all lower-level API provided by superagent. SuperAgent said we c...
Halimeda asked 17/9, 2018 at 2:9

6

I am trying to use supertest for some testing. Here is the code snippet that I am trying to test: it("should create a new org with valid privileges and input with status 201", function(done) { re...
Twain asked 15/1, 2013 at 13:57

3

Solved

I am testing an express API with supertest. I am trying to pass in body parameters into the test, as can be seen in the code snippets below, but it appears that the body parameters don't get passed...
Timeserver asked 13/9, 2016 at 12:50

4

I am trying to test my API endpoints with jest and supertest: my test routes file: const app = require('../../index') const request = require('supertest') describe('test app endpoints', ()=&gt...
Impeachment asked 22/3, 2020 at 18:18

11

Solved

I'm creating a testing for my express app. The project has multiple test files. In each module the server instance is required at beforeEach() method and closed at afterEach() method. but after tes...
Educationist asked 29/1, 2019 at 14:5

1

I'm building an AWS Lambda function and trying to write some integration tests for it. The Lambda function is running locally using serverless-offline plugin and simply receive a GET request with s...

4

I'm starting to test my application using Jest and Supertest (for endpoints). Tests work smoothly but Jest detects 2 open handles after running tests which prevents Jest from exiting cleanly. This ...
Weller asked 13/9, 2021 at 21:52

5

Solved

Here I am attaching my code, I am passing done callback and using supertest for request. Since I am using assert/expect in my testcase inside request.end block why I need to worry about timeout? Wh...
Coralline asked 28/4, 2016 at 6:54

4

I am pretty new to Nodejs and i am learning Nodejs course on udemy, I am facing some trouble of listen EADDRINUSE: address already in use :::4000 while re-running integration tests multiple time. T...
Acescent asked 22/3, 2020 at 19:59

4

Solved

When using supertest like so, import app from "../../src/app"; import request from "supertest"; describe("GET / - a simple api endpoint", () => { it("Hello A...
Cloistral asked 24/6, 2020 at 19:51

3

with supertest, I can make a resquest to test my node.js application var request = require('supertest'); var api = require('../server').app; ... it('json response', function(done){ request(a...
Vargo asked 18/12, 2014 at 18:37

2

I've written some integration test using Jest, Supertest, Moongose. I run all test isolated (test.only) and they work but sometimes don't. Often this happens when I run the entire test suite. I giv...
Chrissie asked 18/4, 2022 at 21:47

2

I'm testing an express server using super-test and I need to test a post call. I assume the post should be successful and return a status of 200 but it is returning 401. I've been told by someone t...
Handcart asked 29/3, 2019 at 19:40

2

I am trying to set a cookie session to a post request in supertest but I cannot. This is my test code: const app = express(); app.set("trust proxy", true); app.use(json()); app.use( coo...
Joettajoette asked 1/3, 2022 at 21:29

2

Solved

I am struggling to resolve a bug in my jest test using supertest, I think it is an issue with my test rather than my code. My issue I am trying to create a back end API using node.js and express, u...
Gravimeter asked 26/11, 2021 at 15:16

2

Solved

In my tests using Supertest and MSW I've noticed that, although they still pass successfully, MSW has started showing warnings for the requests that Supertest is making. For example (see files to r...
Spiegeleisen asked 17/6, 2021 at 18:42

5

Solved

I am testing an express API with supertest. I couldn't get multiple requests in a test case to work with supertest. Below is what i tried in a test case. But the test case seem to only execute the...
Farnsworth asked 13/1, 2014 at 11:12

3

Solved

I'm working with jest & supertest to test my api endpoints and the tests are passing with no problems; however jest is never exiting with the Done in X amount of time statement that I would nor...
Saez asked 17/5, 2017 at 23:17

2

I'm using supertest to send get query string parameters, how can I do that? I tried var imsServer = supertest.agent("https://example.com"); imsServer.get("/") .send({ username: username, pass...
Aloe asked 28/10, 2016 at 16:52

2

I'm testing my API endpoints with supertest, and it works great, but i can't figure out how to test if a file download is successful. In my routes file i have defined the endpoint to be: app.ge...
Eben asked 17/7, 2014 at 12:11

2

Solved

I'm trying to test the routes in my express app that are protected by a jwt middleware. I've tried simulating a request to get the jwt token in a beforeAll call: let token = ""; beforeAll...
Jazzman asked 1/11, 2021 at 9:25

1

I'm working on setting up some tests using Jest and Supertest with my Node Express app. I'm also using Sentry to report my errors. I have the following lines of code in my app.js file to setup Sen...
Iou asked 24/5, 2020 at 16:7

© 2022 - 2024 — McMap. All rights reserved.