Skip to content

Commit

Permalink
Commented out the getWeather2 api and its test cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
jparra5 committed Feb 14, 2017
1 parent dcad126 commit 538667a
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 68 deletions.
2 changes: 2 additions & 0 deletions routes/apiv1.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ exports.getWeather = function(req, res) {
};
router.get('/getWeather', exports.getWeather);

/*
exports.getWeather2 = function(req, res) {
var zip = req.query.zip;
if( (zip === null) || (typeof(zip) === 'undefined') ) {
Expand Down Expand Up @@ -68,5 +69,6 @@ exports.getWeather2 = function(req, res) {
};
router.get('/getWeather2', exports.getWeather2);
*/

exports.router = router;
136 changes: 68 additions & 68 deletions tests/server/apiv1.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,92 +112,92 @@
assert(resMock.send.lastCall.args[0].weather === 'Conditions are cold and temperature is 78 F', 'Unexpected response:' + resMock.send.lastCall.args[0].weather);
});
});

if(!process.env.FAKE_COVERAGE_REGRESSION){
describe('Get Weather 2', function() {

it('with without zip code', function() {
reqMock = {
query: {
/*
describe('Get Weather 2', function() {
}
};
it('with without zip code', function() {
reqMock = {
query: {
apiv1.getWeather2(reqMock, resMock);
}
};
assert(resMock.status.lastCall.calledWith(400), 'Unexpected status code:' + resMock.status.lastCall.args);
});
apiv1.getWeather2(reqMock, resMock);
it('with valid zip code and error from request call', function() {
reqMock = {
query: {
zip: 79968
}
};
assert(resMock.status.lastCall.calledWith(400), 'Unexpected status code:' + resMock.status.lastCall.args);
});
it('with valid zip code and error from request call', function() {
reqMock = {
query: {
zip: 79968
}
};
var request = function( obj, callback ){
callback("error", null, null);
};
var request = function( obj, callback ){
callback("error", null, null);
};
apiv1.__set__("request", request);
apiv1.__set__("request", request);
apiv1.getWeather2(reqMock, resMock);
apiv1.getWeather2(reqMock, resMock);
assert(resMock.status.lastCall.calledWith(400), 'Unexpected response:' + resMock.status.lastCall.args);
assert(resMock.send.lastCall.calledWith('Failed to get the data'), 'Unexpected response:' + resMock.send.lastCall.args);
});
assert(resMock.status.lastCall.calledWith(400), 'Unexpected response:' + resMock.status.lastCall.args);
assert(resMock.send.lastCall.calledWith('Failed to get the data'), 'Unexpected response:' + resMock.send.lastCall.args);
});
it('with incomplete zip code', function() {
reqMock = {
query: {
zip: 79968
}
};
it('with incomplete zip code', function() {
reqMock = {
query: {
zip: 79968
}
};
var request = function( obj, callback ){
callback(null, null, {});
};
var request = function( obj, callback ){
callback(null, null, {});
};
apiv1.__set__("request", request);
apiv1.__set__("request", request);
apiv1.getWeather2(reqMock, resMock);
apiv1.getWeather2(reqMock, resMock);
assert(resMock.status.lastCall.calledWith(400), 'Unexpected response:' + resMock.status.lastCall.args);
assert(resMock.send.lastCall.args[0].msg === 'Failed', 'Unexpected response:' + resMock.send.lastCall.args);
});
assert(resMock.status.lastCall.calledWith(400), 'Unexpected response:' + resMock.status.lastCall.args);
assert(resMock.send.lastCall.args[0].msg === 'Failed', 'Unexpected response:' + resMock.send.lastCall.args);
});
it('with valid zip code', function() {
reqMock = {
query: {
zip: 79968
}
};
it('with valid zip code', function() {
reqMock = {
query: {
zip: 79968
}
};

var body = {
cod: 200,
name: 'El Paso',
weather: [
{
main: 'cold'
}
],
main: {
temp: 78
var body = {
cod: 200,
name: 'El Paso',
weather: [
{
main: 'cold'
}
};
],
main: {
temp: 78
}
};
var request = function( obj, callback ){
callback(null, null, body);
};
var request = function( obj, callback ){
callback(null, null, body);
};
apiv1.__set__("request", request);
apiv1.__set__("request", request);
apiv1.getWeather2(reqMock, resMock);
apiv1.getWeather2(reqMock, resMock);
assert(resMock.status.lastCall.calledWith(200), 'Unexpected response:' + resMock.status.lastCall.args);
assert(resMock.send.lastCall.args[0].city === 'El Paso', 'Unexpected response:' + resMock.send.lastCall.args[0].city);
assert(resMock.send.lastCall.args[0].weather === 'Conditions are cold and temperature is 78 F', 'Unexpected response:' + resMock.send.lastCall.args[0].weather);
});
});
}
assert(resMock.status.lastCall.calledWith(200), 'Unexpected response:' + resMock.status.lastCall.args);
assert(resMock.send.lastCall.args[0].city === 'El Paso', 'Unexpected response:' + resMock.send.lastCall.args[0].city);
assert(resMock.send.lastCall.args[0].weather === 'Conditions are cold and temperature is 78 F', 'Unexpected response:' + resMock.send.lastCall.args[0].weather);
});
});
*/
}());

0 comments on commit 538667a

Please sign in to comment.