Add test for adjustment method 1

This commit is contained in:
Samer Albahra
2019-05-13 21:41:37 -05:00
parent 9275abde27
commit 2928e3e515
2 changed files with 28 additions and 0 deletions

View File

@@ -22,6 +22,18 @@ describe('Watering Data', () => {
await getWateringData(expressMocks.request, expressMocks.response); await getWateringData(expressMocks.request, expressMocks.response);
expect( expressMocks.response._getJSON() ).to.eql( expected.noWeather[location] ); expect( expressMocks.response._getJSON() ).to.eql( expected.noWeather[location] );
}); });
it('OpenWeatherMap Lookup (Adjustment Method 1, Location 01002)', async () => {
nock( 'http://api.openweathermap.org' )
.filteringPath( function() { return "/"; } )
.get( "/" )
.reply( 200, replies[location].OWMData );
const expressMocks = createExpressMocks(1, location);
await getWateringData(expressMocks.request, expressMocks.response);
expect( expressMocks.response._getJSON() ).to.eql( expected.adjustment1[location] );
});
}); });
function createExpressMocks(method: number, location: string) { function createExpressMocks(method: number, location: string) {

View File

@@ -14,5 +14,21 @@
"raining": 1 "raining": 1
} }
} }
},
"adjustment1": {
"01002": {
"scale": 0,
"rd": -1,
"tz": 32,
"sunrise": 332,
"sunset": 1203,
"eip": 2130706433,
"rawData": {
"h": 98.5,
"p": 1.09,
"t": 70.8,
"raining": 1
}
}
} }
} }