0👍
Advised by my leader, I find one magic
config option of sinon fake server as follows
before(function () {
server = sinon.fakeServer.create();
//mock response for ajax request
server.respondWith("/api/nodesWithTask",[200,{"Content-Type":"application/json"},JSON.stringify(mockData)]);
server.respondImmediately = true;
const Constructor = Vue.extend(demo);
vm = new Constructor().$mount();
});
After I set the respondImmediately option to true, the test can run correctly.
- [Vuejs]-Accessing command line arguments in runtime
- [Vuejs]-I'm trying to fetch data from my api using fetch and it returns blank with no errors
Source:stackexchange.com