Is there a way to improve the readability of this Angular Q implementation call? It seems like the d3 loading should be parallel to data loading in this case.
d3Q.init()
.then(function(d3) {
scope.loadHistoryData()
.then(function(data) {
scope.renderHistoryGram(target, data, d3);
});
});
This type of code can be difficult to test due to multiple promises that need to be mocked. Are there any best practices for testing this code?