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 am currently new to Sinon, Mocha, Supertest and in the process to writes tests. In my current scenario, i have authentication library which verifies my "OTP" and after verifying it proceeds to do operation within the callback function.   I...
Is it possible to test an Express JS REST API using supertest but replacing the actual database connection with a mock database object? I have unit tests covering the database models and other parts of the application as well as functional tests of t...
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'm trying to write a test for my server side form validation but I keep getting a Forbidden error.  It seems that this needs to be a 2 step process. Step 1, acquire the CSRF value from the form. Step 2, use the CSRF value to post to the form han...
I'm trying to test for the presence of some api response properties that I want to require across all tests (a status and data property).  Here's a generic test that asserts the desired properties in a supertest expect() method:      it('...
This is a question regarding asynchronoust testing in Sails JS using Mocha.  I am writing controller test in Sails JS using supertest library. I want to check if a method is being called on HTTP POST to our controller. For that, I am stubbing the met...
So I'm a bit new to nodejs and promise handling, and I'm trying to figure out what I'm doing wrong here.   Right now when I run this test I expect it to fail with the error message in throw new Error but instead the test passes and then j...
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...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.