mardi 3 octobre 2017

Nock hangs during test

I'm currently using nock to mock a axios request but for some reason it just hangs, not passing or failing.

Test.js:

nock("http://ift.tt/2xYHyR7", {
    reqheaders: {
        'x-api-key': apiKey
    }
  }).log(console.log)
    .get("/beta/apps/DEMO_APP/query?query=requests| where timestamp >= ago(24h)| make-series count() default=0 on timestamp in range(ago(23h), ago(1h), 1h)| mvexpand count_ to typeof(long), timestamp to typeof(datetime)")
    .reply(200, expectedGraph);

return client.graph({ chartType, datasets, appID, apiKey, graphID, xLabel, yLabel })
    .then(function (graphData) {
        console.log(graphData);
        t.deepEqual(graphData.appJson.length, expectedGraph.appJson.length);
});

client.js(client.graph()):

return axios.all(queries.map(q => axios.get("http://ift.tt/2fI3fdS" + appID + "/query?query=" + q, headers)))
            .then(function (response) {
...
})
.catch(err => {
...
});

Aucun commentaire:

Enregistrer un commentaire