I need to mock client side HTTP requests. I'm using isomorphic-fetch in the client side and I'm using mocha and nock for testing and mocking. All my client requests are based on relative path. Due to this I'm unable to provide host name f...
I am learning how to test and using some examples as a guideline I am trying to mock a login post. The example used fetch for the http call but I using axios. This is the error I am getting     Timeout - Async callback was not invoked within timeout...
I'm trying to simulate service request timeouts to test the node requestretry module, which allows you to specify a request max # of attempted retries and retry delay. In order to test this, I need to use nock to simulate a timeout for the first...
When I stub request with nock it returns String result instead of Object even with 'Content-Type': 'application/json':  var response = {   success: true,   statusCode: 200,   body: {     "status": "OK",     "id"...
I am making request with axios.js library and part of my integration test suite are expectations on data send in body of POST request, done by axios, to see if it's ok. During development I'he used nock.js and put expectations inside .post no...
In node.js, I have trouble making superagent and nock work together. If I use request instead of superagent, it works perfectly.  Here is a simple example where superagent fails to report the mocked data:  var agent = require('superagent'); v...
I'm writing code interacting with PayPal classic API. The first part of this interaction is to send request to PayPal and get a token from them. For that I use simple https request:  function makePayPalRequestForToken(options, callback) {  var re...
Hello I am writing unit test case of my function which is like  const Services = {     test: async (token) => {      .. ...     }  }   I have written unit test of this function, report says test covered all lines of this function but async (token)...
I've written an asynchronous JavaScript function though do not seem to be getting the returned value I expect.  Could somebody explain if I'm misunderstanding how async functions work or if it's something not quite right my test?  Below i...
Having trouble using Nock.js to mock an HTTP Post Request with csv file attachment.  With superagent this is possible:  authenticatedSession       .post('/foo')       .set('Content-Type', 'multipart/form-data')       .attach(&...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.