Add ability to test against Weather Underground
This commit is contained in:
37
test/api.js
37
test/api.js
@@ -8,12 +8,43 @@ var hippie = require( "hippie" ),
|
|||||||
describe( "Weather API", function() {
|
describe( "Weather API", function() {
|
||||||
describe( "/:method endpoint", function() {
|
describe( "/:method endpoint", function() {
|
||||||
it( "The Weather Channel Source Test", function( done ) {
|
it( "The Weather Channel Source Test", function( done ) {
|
||||||
for ( var test in expected ) {
|
for ( var test in expected.WSI ) {
|
||||||
if ( expected.hasOwnProperty( test ) ) {
|
if ( expected.WSI.hasOwnProperty( test ) ) {
|
||||||
apiTest( {
|
apiTest( {
|
||||||
method: 1,
|
method: 1,
|
||||||
loc: test,
|
loc: test,
|
||||||
expected: expected[test],
|
expected: expected.WSI[test],
|
||||||
|
callback: function( reply ) {
|
||||||
|
done();
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
it( "Weather Underground Source Test", function( done ) {
|
||||||
|
for ( var test in expected.WU ) {
|
||||||
|
if ( expected.WU.hasOwnProperty( test ) ) {
|
||||||
|
apiTest( {
|
||||||
|
method: 1,
|
||||||
|
loc: test,
|
||||||
|
key: process.env.WU_API_KEY,
|
||||||
|
expected: expected.WU[test],
|
||||||
|
callback: function( reply ) {
|
||||||
|
done();
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
it( "Information lookup without weather lookup", function( done ) {
|
||||||
|
for ( var test in expected.noWeather ) {
|
||||||
|
if ( expected.noWeather.hasOwnProperty( test ) ) {
|
||||||
|
apiTest( {
|
||||||
|
method: 0,
|
||||||
|
loc: test,
|
||||||
|
expected: expected.noWeather[test],
|
||||||
callback: function( reply ) {
|
callback: function( reply ) {
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,32 @@
|
|||||||
{
|
{
|
||||||
"01002": {
|
"WSI": {
|
||||||
"scale": 83,
|
"01002": {
|
||||||
"restrict": 0,
|
"scale": 83,
|
||||||
"tz": 32,
|
"restrict": 0,
|
||||||
"sunrise": 324,
|
"tz": 32,
|
||||||
"sunset": 1226,
|
"sunrise": 324,
|
||||||
"eip": 2130706433
|
"sunset": 1226,
|
||||||
|
"eip": 2130706433
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"WU": {
|
||||||
|
"01002": {
|
||||||
|
"scale": 61,
|
||||||
|
"restrict": 0,
|
||||||
|
"tz": 32,
|
||||||
|
"sunrise": 324,
|
||||||
|
"sunset": 1228,
|
||||||
|
"eip": 2130706433
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"noWeather": {
|
||||||
|
"01002": {
|
||||||
|
"scale": -1,
|
||||||
|
"restrict": 0,
|
||||||
|
"tz": 32,
|
||||||
|
"sunrise": 324,
|
||||||
|
"sunset": 1226,
|
||||||
|
"eip": 2130706433
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user