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);
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) {