Add test for adjustment method 1
This commit is contained in:
@@ -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) {
|
||||||
|
|||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user