Skip to content

Commit

Permalink
fixed flight endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
kristjanmik committed Dec 2, 2013
1 parent 29ae671 commit ec32875
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions endpoints/flight/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ app.get('/flight', function(req, res){
}else if(data.type == 'arrivals' && data.language == 'en'){
url = 'http://www.kefairport.is/English/Timetables/Arrivals/';
}else{
return res.json(431,{'error':'Wrong parameters given!'});
url = 'http://www.kefairport.is/English/Timetables/Arrivals/';
}

request.get({
Expand All @@ -37,7 +37,7 @@ app.get('/flight', function(req, res){

var obj = { results: []};

var fields = ['date','flightNumber','airline','to','plannedArrival','realArrival','status'];
var fields = ['date','flightNumber','airline','to','from','plannedArrival','realArrival','status'];

data.find('table tr').each(function(key){
if(key !== 0){
Expand Down
2 changes: 1 addition & 1 deletion endpoints/flight/tests/integration_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var helpers = require('../../../lib/test_helpers.js');

describe('flight', function() {
it("should return an array of objects containing correct fields", function(done) {
var fieldsToCheckFor = ["date","flightNumber","airline","to","plannedArrival","realArrival","status"];
var fieldsToCheckFor = ["date","flightNumber","airline","to","from","plannedArrival","realArrival","status"];
var params = helpers.testRequestParams("/flight", {
language: "en",
type: "departures"
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
"moment": "~2.1.0",
"xml2js": "~0.2.8",
"express": "~3.3.8",
"cheerio": "~0.12.3",
"request": "~2.27.0",
"mocha": "~1.12.1",
"scraper": "0.0.9",
"jquery": "~1.8.3",
"cluster-master": "~0.1.2",
"redis": "~0.8.4",
"xregexp": "~2.0.0"
"xregexp": "~2.0.0",
"cheerio": "~0.12.4"
},
"scripts": {
"test": "node_modules/mocha/bin/mocha test/integration",
Expand Down
3 changes: 2 additions & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ app.use(cache());
fileModule.walkSync('./endpoints', function(dirPath, dirs, files){
if(files && dirPath.indexOf("/test") < 0){
files.forEach(function(file,key){
require('./'+dirPath+'/'+file);
if(file.indexOf('.DS_Store') === -1)
require('./'+dirPath+'/'+file);
});
}
});
Expand Down

0 comments on commit ec32875

Please sign in to comment.