Questions tagged [supertest]

SuperTest is a module that provides high-level abstraction for testing HTTP in node.js, using low-level API provided by super-agent.

SuperTest is a module that provides high-level abstraction for testing HTTP in node.js, using low-level API provided by super-agent.

922 questions
-1
votes
1 answer

Test GraphQl passport Context

Okey, this is the repo What I want to do: Test my protected routes. Currently, the security of the app is handle by passport, with this strategy: graphql-passport. I am running my rests with supertest (for the request) and jest When I build the…
ValRob
  • 2,584
  • 7
  • 32
  • 40
-1
votes
2 answers

How to test key and value of object using supertest module

I have test code as below: const mocha = require('mocha'); const describe = mocha.describe; const it = mocha.it; const chai = require('chai'); const request = require('supertest'); const app = require('../app.test'); chai.should(); describe('Get…
Thomas Jason
  • 538
  • 2
  • 7
  • 18
-1
votes
1 answer

Express.js, Jest, Supertest: Trouble with test runner finding a route handler

I'm trying to setup tests on an Express server using Jest and Supertest. Here is my test and target code: // routes/index.js var express = require('express'); var router = express.Router(); router.get('/', function(req, res, next) { …
Sean D
  • 3,810
  • 11
  • 45
  • 90
-1
votes
2 answers

Node js supertest is async?

I want to write some tests for some routes and I want to do something like this: var should = require('should'); var app = require('../../app'); var request = require('supertest'); describe('Create and check that the create was successfull',…
exilonX
  • 1,712
  • 3
  • 26
  • 50
-2
votes
1 answer

Environment variable not available in a route while using NodeJS + Express and testing with Jest + Supertest

I am using dotenv to load an environment variable which is intended to be an API Token. All requests made to this API are valid only if they carry this token in a header. I've already tried using: require("dotenv").config(); in my app.js file and…
Ed de Almeida
  • 3,675
  • 4
  • 25
  • 57
-4
votes
2 answers

Getting ReferenceError: err is not defined

I am new to js trying to learn supertest and stuck in this error. import { describe } from "mocha"; import supertest from "supertest"; import { expect } from "chai"; const request = supertest('https://gorest.co.in/public/v2/'); const api_token =…
1 2 3
61
62