I need to test an API served via HTTPS with mocha and super test (the certificate are not expired)  This is a gist of the server :   ... var app = express(); var _options = {     key: fs.readFileSync('my-key.pem');,     cert: fs.readFileSync(...
When using supertest for testing async HTTP requests in JavaScript, what's the difference between these two snippets? Is one of them correct and the other one wrong?  request('http://localhost:8080/').get('/api/people')   .expect(...
I have an image upload endpoint in my API that accepts application/octet-stream requests and handles these streams. I'd like to write test coverage for this endpoint but cannot figure out how to use supertest to stream an image.  Here's my co...
I like to use SuperTest to work with my auth system like this:      const request = require('./valid_access_token')(require('supertest'));      request(app)     .get('/v1/bots')     .valid_token()     .expect('Content-Type...
I read about supertest. I managed to test two of my routes:  it('notAuthorized', function (done) {     request.agent(server)         .get('/notAuthorized')         .expect('Content-Type', /html/)         .expect(200)         ....
I am unable to run multiple Supertest/Mocha tests as I get an error Error: Trying to open unclosed connection. - I found this post which suggest looping and checking connection status. Wondering if there is a better way? perhaps something that was ad...
I found that I have many repeated tests cases in multiple integration tests in a Node.js REST API. So for example, I test invalid requests for every endpoint where I expect an error to always have the same properties.  import { app } from 'server...
I'm new to backend development and i face a problem that i don't understand.  I set up the 1st route of my API called "health" who just return a simple message to know if my server is up.  This route looks to works as expected.  Howev...
tl;dr; Sending below curl works but I cannot do the same in supertest (what wrap superagent https://github.com/visionmedia/superagent/)  curl 'http://local/api/items' -X DELETE -H 'Accept-Encoding: gzip, deflate' -H 'content-type:...
Below is the following body format I need to send in a request:  [{   "user_id": "861",   "username": "userA",   "friend_id": "1270" }, {   "user_id": "861",   "username": "u...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.