Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

yahoo geocoder + tests fixed

  • Loading branch information...
commit 96b16da4659f35ae139c0c629f2ce35dcfdd2748 1 parent b9437eb
@xavijam xavijam authored
Showing with 10 additions and 10 deletions.
  1. +4 −4 src/geo/geocoder.js
  2. +6 −6 test/spec/geo/geocoder.spec.js
View
8 src/geo/geocoder.js
@@ -31,15 +31,15 @@ cdb.geo.geocoder.YAHOO = {
$.getJSON(protocol + '//query.yahooapis.com/v1/public/yql?q='+encodeURIComponent('SELECT * FROM json WHERE url="http://where.yahooapis.com/geocode?q=' + address + '&appid=' + this.keys.app_id + '&flags=JX"') + '&format=json&callback=?', function(data) {
var coordinates = [];
- if (data && data.query && data.query.results && data.query.results.ResultSet && data.query.results.ResultSet.Found != "0") {
+ if (data && data.query && data.query.results && data.query.results.json && data.query.results.json.ResultSet && data.query.results.json.ResultSet.Found != "0") {
// Could be an array or an object |arg!
var res;
- if (_.isArray(data.query.results.ResultSet.Results)) {
- res = data.query.results.ResultSet.Results;
+ if (_.isArray(data.query.results.json.ResultSet.Results)) {
+ res = data.query.results.json.ResultSet.Results;
} else {
- res = [data.query.results.ResultSet.Results];
+ res = [data.query.results.json.ResultSet.Results];
}
for(var i in res) {
View
12 test/spec/geo/geocoder.spec.js
@@ -6,8 +6,8 @@ describe('Geocoder', function() {
it('we should get a direction that exists using YAHOO', function() {
cdb.geo.geocoder.YAHOO.geocode('Madrid, Spain', function(data) {
expect(data.length).toEqual(1);
- expect(data[0].lat).toEqual('40.420300');
- expect(data[0].lon).toEqual('-3.705774');
+ expect(data[0].lat).toEqual('40.4203');
+ expect(data[0].lon).toEqual('-3.70577');
expect(data[0].boundingbox).toBeTruthy();
});
});
@@ -21,8 +21,8 @@ describe('Geocoder', function() {
it('we should get a direction that exists using NOKIA', function() {
cdb.geo.geocoder.NOKIA.geocode('Madrid, Spain', function(data) {
expect(data.length).toEqual(1);
- expect(data[0].lat).toEqual(parseFloat('40.4203'));
- expect(data[0].lon).toEqual(parseFloat('-3.70577'));
+ expect(data[0].lat).toEqual(40.420300);
+ expect(data[0].lon).toEqual(-3.70577);
expect(data[0].boundingbox).toBeTruthy();
});
});
@@ -30,8 +30,8 @@ describe('Geocoder', function() {
it('we should get a direction with # character using NOKIA', function() {
cdb.geo.geocoder.NOKIA.geocode('# Mexico', function(data) {
expect(data.length).toEqual(1);
- expect(data[0].lat).toEqual('19.4321');
- expect(data[0].lon).toEqual('-99.1331');
+ expect(data[0].lat).toEqual(19.4321);
+ expect(data[0].lon).toEqual(-99.1331);
});
});
Please sign in to comment.
Something went wrong with that request. Please try again.