-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added street view API (similar to static maps) including tests for st…
…reet view
- Loading branch information
Showing
3 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
var vows = require('vows'), | ||
assert = require('assert'), | ||
crypto = require('crypto'), | ||
gm = require('../lib/googlemaps'); | ||
|
||
vows.describe('streetview').addBatch({ | ||
'Street View': { | ||
|
||
'Simple Parameters URL': { | ||
topic: function(options){ | ||
return gm.streetView('600x300', '56.960654,-2.201815', false); | ||
}, | ||
'returns the expected street view URL': function(result){ | ||
assert.equal(result , "http://maps.googleapis.com/maps/api/streetview?size=600x300&location=56.960654%2C-2.201815&sensor=false"); | ||
} | ||
}, | ||
|
||
'Simple Parameters Image data (jpeg)': { | ||
topic: function(options){ | ||
gm.streetView('600x300', '56.960654,-2.201815', this.callback); | ||
}, | ||
'returns the expected static map Image data': function(err, data){ | ||
var md5 = crypto.createHash('md5'); | ||
md5.update(data); | ||
assert.equal(md5.digest('hex') , 'a355992522bc7d640ba605268e703e37'); | ||
} | ||
}, | ||
|
||
'With Optonal Parameters URL': { | ||
topic: function(options){ | ||
return gm.streetView('600x300', '56.960654,-2.201815', false, false, "250", "90", "-10"); | ||
}, | ||
'returns the expected street view URL': function(result){ | ||
assert.equal(result , "http://maps.googleapis.com/maps/api/streetview?size=600x300&location=56.960654%2C-2.201815&heading=250&fov=90&pitch=-10&sensor=false"); | ||
} | ||
}, | ||
|
||
'With Optonal Parameters Image data (jpeg)': { | ||
topic: function(options){ | ||
gm.streetView('600x300', '56.960654,-2.201815', this.callback, false, "250", "90", "-10"); | ||
}, | ||
'returns the expected static map Image data': function(err, data){ | ||
var md5 = crypto.createHash('md5'); | ||
md5.update(data); | ||
assert.equal(md5.digest('hex') , 'f408a7709312394a9ed88ad33cee6145'); | ||
} | ||
}, | ||
|
||
'With invalid Parameters URL': { | ||
topic: function(options){ | ||
return gm.streetView('600x300', '56.960654,-2.201815', false, false, "9999", "9999", "9999"); | ||
}, | ||
'returns the expected street view URL': function(result){ | ||
assert.equal(result , "http://maps.googleapis.com/maps/api/streetview?size=600x300&location=56.960654%2C-2.201815&sensor=false"); | ||
} | ||
}, | ||
|
||
'With invalid Parameters Image data (jpeg)': { | ||
topic: function(options){ | ||
gm.streetView('600x300', '56.960654,-2.201815', this.callback, false, "9999", "9999", "9999"); | ||
}, | ||
'returns the expected static map Image data': function(err, data){ | ||
var md5 = crypto.createHash('md5'); | ||
md5.update(data); | ||
assert.equal(md5.digest('hex') , 'a355992522bc7d640ba605268e703e37'); | ||
} | ||
} | ||
} | ||
}).export(module); |