I am trying to load the Google Maps API in jsdom. More specifically, I'm interested in getting data from the getPanorama callback function. However, when I execute the following code, I see "Completed without errors", but I do not see any status messages ok 'or' status not ok '.
var jsdom = require("jsdom");
var cafe = {lat: 51.47803167, lng: 0.141212256};
jsdom.env({
html: "<html><body></body></html>",
scripts: ["https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"],
done: function (err, window) {
if (err) {
console.log('Error is' + err);
} else {
var google = window.google;
var sv = new google.maps.StreetViewService();
sv.getPanorama({location: cafe}, function(data, status) {
if (status === 'OK') {
console.log('status ok');
console.log(data);
} else {
console.log('status not ok');
}
});
console.log('Executed with no error');
}
}
});
I also tried changing the code and using jsdom.jsdom instead of env, but nothing worked. Any ideas on how I can get the data from the callback in my node code?
source
share