Skip to content

Commit

Permalink
Expanded with election, candidates and more represenative functions
Browse files Browse the repository at this point in the history
  • Loading branch information
geraldhumphries committed Jun 9, 2015
1 parent 09a8676 commit 477dbf4
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 2 deletions.
24 changes: 22 additions & 2 deletions lib/represent.js
Expand Up @@ -17,8 +17,8 @@ var Represent = {
});
}

, boundarySets: function(boundary, callback){
Represent.get("/boundary-sets/" + boundary, callback);
, boundarySets: function(boundarySet, callback){
Represent.get("/boundary-sets/" + boundarySet, callback);
}

, boundaries: function(boundary, callback){
Expand All @@ -33,9 +33,29 @@ var Represent = {
Represent.get("/postcodes/" + code, callback);
}

, representativeSets: function(representativeSet, callback){
Represent.get("/representative-sets/" + representativeSet, callback);
}

, representatives: function(representative, callback){
Represent.get("/representatives/" + representative, callback);
}

, representativesLatLon: function(lat, lon, callback){
Represent.get("/representatives/?point=" + lat + "," + lon, callback);
}

, elections: function(election, callback){
Represent.get("/elections/" + election, callback);
}

, candidates: function(candidates, callback){
Represent.get("/candidates/" + candidates, callback);
}

, candidatesLatLon: function(lat, lon, callback){
Represent.get("/candidates/?point=" + lat + "," + lon, callback);
}
};

module.exports = Represent;
70 changes: 70 additions & 0 deletions test/api.test.js
Expand Up @@ -59,6 +59,34 @@ describe("API", function(){
});
});

describe("representativeSets", function(){
var data;
before(function(done){
Represent.representativeSets("ontario-legislature", function(error, response){
data = response;
done(error);
});
});

it("should respond with data", function(){
assert(data);
});
});

describe("representatives", function(){
var data;
before(function(done){
Represent.representatives("house-of-commons", function(error, response){
data = response;
done(error);
});
});

it("should respond with data", function(){
assert(data);
});
});

describe("representativesLatLon", function(){
var data;
before(function(done){
Expand All @@ -73,4 +101,46 @@ describe("API", function(){
});
});

describe("elections", function(){
var data;
before(function(done){
Represent.elections("house-of-commons", function(error, response){
data = response;
done(error);
});
});

it("should respond with data", function(){
assert(data);
});
});

describe("candidates", function(){
var data;
before(function(done){
Represent.candidates("house-of-commons", function(error, response){
data = response;
done(error);
});
});

it("should respond with data", function(){
assert(data);
});
});

describe("candidatesLatLon", function(){
var data;
before(function(done){
Represent.candidatesLatLon(45.524, -73.596, function(error, response){
data = response;
done(error);
});
});

it("should respond with data", function(){
assert(data);
});
});

});

0 comments on commit 477dbf4

Please sign in to comment.