jubilee/test/weather.spec.js
2018-04-11 16:33:07 +01:00

1535 lines
44 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const { reduceWeather } = require('../server/reducers/weather');
const expect = require('expect.js');
const requestData = {
'alerts': [
{
'description': 'Scattered snow showers will affect northern Scotland during the early hours of Tuesday morning. A spell of persistent rain and hill snow is expected to develop through Tuesday morning across southern Scotland, extending into northern Scotland in the afternoon and evening.',
'expires': 1520370000,
'regions': [
'Grampian',
'Central, Tayside & Fife',
'Strathclyde',
'SW Scotland, Lothian Borders',
'Highlands & Eilean Siar'
],
'severity': 'advisory',
'time': 1520294700,
'title': 'Rain Warning',
'uri': 'http://www.metoffice.gov.uk/public/weather/warnings/'
},
{
'description': 'Scattered snow showers will affect northern Scotland during the early hours of Tuesday morning. A spell of persistent rain and hill snow is expected to develop through Tuesday morning across southern Scotland, extending into northern Scotland in the afternoon and evening',
'expires': 1520370000,
'regions': [
'Grampian',
'Central, Tayside & Fife',
'Strathclyde',
'SW Scotland, Lothian Borders',
'Highlands & Eilean Siar'
],
'severity': 'advisory',
'time': 1520294700,
'title': 'Snow Warning',
'uri': 'http://www.metoffice.gov.uk/public/weather/warnings/'
}
],
'currently': {
'apparentTemperature': -2.52,
'cloudCover': 0.66,
'dewPoint': 1.29,
'humidity': 0.91,
'icon': 'rain',
'nearestStormDistance': 0,
'ozone': 475.7,
'precipIntensity': 0.4826,
'precipIntensityError': 0.254,
'precipProbability': 0.99,
'precipType': 'rain',
'pressure': 985.59,
'summary': 'Light Rain',
'temperature': 2.62,
'time': 1520336355,
'uvIndex': 1,
'visibility': 7.71,
'windBearing': 73,
'windGust': 31.09,
'windSpeed': 15.49
},
'daily': {
'data': [
{
'apparentTemperatureHigh': 3.21,
'apparentTemperatureHighTime': 1520359200,
'apparentTemperatureLow': -0.03,
'apparentTemperatureLowTime': 1520409600,
'apparentTemperatureMax': 3.21,
'apparentTemperatureMaxTime': 1520359200,
'apparentTemperatureMin': -3.28,
'apparentTemperatureMinTime': 1520326800,
'cloudCover': 0.85,
'dewPoint': 1.32,
'humidity': 0.89,
'icon': 'rain',
'moonPhase': 0.66,
'ozone': 469.48,
'precipIntensity': 0.3708,
'precipIntensityMax': 0.8306,
'precipIntensityMaxTime': 1520294400,
'precipProbability': 0.92,
'precipType': 'rain',
'pressure': 986.37,
'summary': 'Mixed precipitation in the morning.',
'sunriseTime': 1520319484,
'sunsetTime': 1520359422,
'temperatureHigh': 3.56,
'temperatureHighTime': 1520348400,
'temperatureLow': 2.55,
'temperatureLowTime': 1520384400,
'temperatureMax': 3.92,
'temperatureMaxTime': 1520305200,
'temperatureMin': 1.54,
'temperatureMinTime': 1520326800,
'time': 1520294400,
'uvIndex': 1,
'uvIndexTime': 1520334000,
'visibility': 4.88,
'windBearing': 73,
'windGust': 34.43,
'windGustTime': 1520326800,
'windSpeed': 9.23
},
{
'apparentTemperatureHigh': 4.05,
'apparentTemperatureHighTime': 1520438400,
'apparentTemperatureLow': -1.58,
'apparentTemperatureLowTime': 1520488800,
'apparentTemperatureMax': 4.05,
'apparentTemperatureMaxTime': 1520438400,
'apparentTemperatureMin': -0.67,
'apparentTemperatureMinTime': 1520463600,
'cloudCover': 0.8100000000000001,
'dewPoint': 0.48,
'humidity': 0.8,
'icon': 'snow',
'moonPhase': 0.6899999999999999,
'ozone': 432.7,
'precipIntensity': 0.1981,
'precipIntensityMax': 0.4851,
'precipIntensityMaxTime': 1520463600,
'precipProbability': 0.67,
'precipType': 'rain',
'pressure': 987.72,
'summary': 'Light snow (12 cm.) starting in the evening.',
'sunriseTime': 1520405729,
'sunsetTime': 1520445948,
'temperatureHigh': 6.48,
'temperatureHighTime': 1520434800,
'temperatureLow': 1.49,
'temperatureLowTime': 1520488800,
'temperatureMax': 6.48,
'temperatureMaxTime': 1520434800,
'temperatureMin': 2.37,
'temperatureMinTime': 1520463600,
'time': 1520380800,
'uvIndex': 1,
'uvIndexTime': 1520420400,
'visibility': 9.699999999999999,
'windBearing': 160,
'windGust': 18.16,
'windGustTime': 1520424000,
'windSpeed': 5.26
},
{
'apparentTemperatureHigh': 6.42,
'apparentTemperatureHighTime': 1520521200,
'apparentTemperatureLow': -0.18,
'apparentTemperatureLowTime': 1520553600,
'apparentTemperatureMax': 6.42,
'apparentTemperatureMaxTime': 1520521200,
'apparentTemperatureMin': -1.58,
'apparentTemperatureMinTime': 1520488800,
'cloudCover': 0.35,
'dewPoint': -0.41,
'humidity': 0.75,
'icon': 'partly-cloudy-night',
'moonPhase': 0.72,
'ozone': 450.79,
'precipIntensity': 0.1143,
'precipIntensityMax': 0.4369,
'precipIntensityMaxTime': 1520467200,
'precipProbability': 0.58,
'precipType': 'rain',
'pressure': 988.24,
'summary': 'Mostly cloudy starting in the afternoon.',
'sunriseTime': 1520491974,
'sunsetTime': 1520532472,
'temperatureHigh': 7.3,
'temperatureHighTime': 1520521200,
'temperatureLow': 2.41,
'temperatureLowTime': 1520564400,
'temperatureMax': 7.3,
'temperatureMaxTime': 1520521200,
'temperatureMin': 1.49,
'temperatureMinTime': 1520488800,
'time': 1520467200,
'uvIndex': 1,
'uvIndexTime': 1520503200,
'visibility': 10,
'windBearing': 148,
'windGust': 26.36,
'windGustTime': 1520550000,
'windSpeed': 5.08
},
{
'apparentTemperatureHigh': 6.23,
'apparentTemperatureHighTime': 1520614800,
'apparentTemperatureLow': -3.38,
'apparentTemperatureLowTime': 1520665200,
'apparentTemperatureMax': 6.23,
'apparentTemperatureMaxTime': 1520614800,
'apparentTemperatureMin': -0.18,
'apparentTemperatureMinTime': 1520553600,
'cloudCover': 0.54,
'dewPoint': 0.57,
'humidity': 0.79,
'icon': 'partly-cloudy-day',
'moonPhase': 0.75,
'ozone': 455.45,
'precipIntensity': 0.1448,
'precipIntensityMax': 0.4089,
'precipIntensityMaxTime': 1520553600,
'precipProbability': 0.59,
'precipType': 'rain',
'pressure': 993.4,
'summary': 'Partly cloudy throughout the day.',
'sunriseTime': 1520578218,
'sunsetTime': 1520618997,
'temperatureHigh': 6.74,
'temperatureHighTime': 1520607600,
'temperatureLow': 0.01,
'temperatureLowTime': 1520661600,
'temperatureMax': 6.74,
'temperatureMaxTime': 1520607600,
'temperatureMin': 2.07,
'temperatureMinTime': 1520636400,
'time': 1520553600,
'uvIndex': 1,
'uvIndexTime': 1520589600,
'visibility': 10,
'windBearing': 232,
'windGust': 26.25,
'windGustTime': 1520553600,
'windSpeed': 3.46
},
{
'apparentTemperatureHigh': 1.76,
'apparentTemperatureHighTime': 1520690400,
'apparentTemperatureLow': -4.04,
'apparentTemperatureLowTime': 1520748000,
'apparentTemperatureMax': 1.76,
'apparentTemperatureMaxTime': 1520690400,
'apparentTemperatureMin': -3.4,
'apparentTemperatureMinTime': 1520722800,
'cloudCover': 0.85,
'dewPoint': -1.02,
'humidity': 0.78,
'icon': 'snow',
'moonPhase': 0.78,
'ozone': 431.78,
'precipAccumulation': 2.002,
'precipIntensity': 0.2845,
'precipIntensityMax': 1.2471,
'precipIntensityMaxTime': 1520704800,
'precipProbability': 0.51,
'precipType': 'snow',
'pressure': 992.8200000000001,
'summary': 'Mixed precipitation starting in the evening and breezy overnight.',
'sunriseTime': 1520664462,
'sunsetTime': 1520705521,
'temperatureHigh': 5.78,
'temperatureHighTime': 1520690400,
'temperatureLow': 1.51,
'temperatureLowTime': 1520748000,
'temperatureMax': 5.78,
'temperatureMaxTime': 1520690400,
'temperatureMin': 0.01,
'temperatureMinTime': 1520661600,
'time': 1520640000,
'uvIndex': 1,
'uvIndexTime': 1520676000,
'visibility': 7.41,
'windBearing': 58,
'windGust': 35.21,
'windGustTime': 1520722800,
'windSpeed': 10.73
},
{
'apparentTemperatureHigh': 3.24,
'apparentTemperatureHighTime': 1520780400,
'apparentTemperatureLow': 0.03,
'apparentTemperatureLowTime': 1520802000,
'apparentTemperatureMax': 3.24,
'apparentTemperatureMaxTime': 1520780400,
'apparentTemperatureMin': -4.04,
'apparentTemperatureMinTime': 1520748000,
'cloudCover': 1,
'dewPoint': 1.16,
'humidity': 0.89,
'icon': 'snow',
'moonPhase': 0.8100000000000001,
'ozone': 442.51,
'precipIntensity': 0.4496,
'precipIntensityMax': 1.0465,
'precipIntensityMaxTime': 1520748000,
'precipProbability': 0.77,
'precipType': 'rain',
'pressure': 982.1900000000001,
'summary': 'Snow (13 cm.) and windy in the morning.',
'sunriseTime': 1520750706,
'sunsetTime': 1520792045,
'temperatureHigh': 6.12,
'temperatureHighTime': 1520780400,
'temperatureLow': 1.58,
'temperatureLowTime': 1520823600,
'temperatureMax': 6.12,
'temperatureMaxTime': 1520780400,
'temperatureMin': 1.51,
'temperatureMinTime': 1520748000,
'time': 1520726400,
'uvIndex': 1,
'uvIndexTime': 1520766000,
'visibility': 3.72,
'windBearing': 61,
'windGust': 42.4,
'windGustTime': 1520748000,
'windSpeed': 11.45
},
{
'apparentTemperatureHigh': 1,
'apparentTemperatureHighTime': 1520870400,
'apparentTemperatureLow': -1.29,
'apparentTemperatureLowTime': 1520899200,
'apparentTemperatureMax': 1.77,
'apparentTemperatureMaxTime': 1520816400,
'apparentTemperatureMin': -1.16,
'apparentTemperatureMinTime': 1520895600,
'cloudCover': 0.99,
'dewPoint': 1.68,
'humidity': 0.9,
'icon': 'wind',
'moonPhase': 0.84,
'ozone': 451,
'precipIntensity': 0.2972,
'precipIntensityMax': 0.4623,
'precipIntensityMaxTime': 1520866800,
'precipProbability': 0.67,
'precipType': 'rain',
'pressure': 982.1900000000001,
'summary': 'Mostly cloudy throughout the day and windy starting in the afternoon, continuing until evening.',
'sunriseTime': 1520836949,
'sunsetTime': 1520878568,
'temperatureHigh': 4.83,
'temperatureHighTime': 1520866800,
'temperatureLow': 2.88,
'temperatureLowTime': 1520902800,
'temperatureMax': 4.83,
'temperatureMaxTime': 1520866800,
'temperatureMin': 1.58,
'temperatureMinTime': 1520823600,
'time': 1520812800,
'uvIndex': 1,
'uvIndexTime': 1520852400,
'windBearing': 257,
'windGust': 39.68,
'windGustTime': 1520870400,
'windSpeed': 6.48
},
{
'apparentTemperatureHigh': 3.3,
'apparentTemperatureHighTime': 1520953200,
'apparentTemperatureLow': -0.71,
'apparentTemperatureLowTime': 1521007200,
'apparentTemperatureMax': 3.3,
'apparentTemperatureMaxTime': 1520953200,
'apparentTemperatureMin': -1.29,
'apparentTemperatureMinTime': 1520899200,
'cloudCover': 0.34,
'dewPoint': 0.6899999999999999,
'humidity': 0.77,
'icon': 'partly-cloudy-day',
'moonPhase': 0.87,
'ozone': 445.04,
'precipIntensity': 0.0483,
'precipIntensityMax': 0.1499,
'precipIntensityMaxTime': 1520902800,
'precipProbability': 0.42,
'precipType': 'rain',
'pressure': 990.13,
'summary': 'Partly cloudy until evening.',
'sunriseTime': 1520923191,
'sunsetTime': 1520965092,
'temperatureHigh': 7.32,
'temperatureHighTime': 1520953200,
'temperatureLow': 3.44,
'temperatureLowTime': 1521007200,
'temperatureMax': 7.32,
'temperatureMaxTime': 1520953200,
'temperatureMin': 2.88,
'temperatureMinTime': 1520902800,
'time': 1520899200,
'uvIndex': 1,
'uvIndexTime': 1520931600,
'windBearing': 267,
'windGust': 29.97,
'windGustTime': 1520899200,
'windSpeed': 13.5
}
],
'icon': 'rain',
'summary': 'Mixed precipitation today through Sunday, with temperatures rising to 7°C next Tuesday.'
},
'hourly': {
'data': [
{
'apparentTemperature': -2.78,
'cloudCover': 0.62,
'dewPoint': 1.22,
'humidity': 0.91,
'icon': 'partly-cloudy-day',
'ozone': 476.47,
'precipIntensity': 0.4928,
'precipProbability': 0.45,
'precipType': 'rain',
'pressure': 985.62,
'summary': 'Mostly Cloudy',
'temperature': 2.49,
'time': 1520334000,
'uvIndex': 1,
'visibility': 6.5,
'windBearing': 71,
'windGust': 32.51,
'windSpeed': 16.08
},
{
'apparentTemperature': -2.38,
'cloudCover': 0.68,
'dewPoint': 1.33,
'humidity': 0.91,
'icon': 'partly-cloudy-day',
'ozone': 475.29,
'precipIntensity': 0.3988,
'precipProbability': 0.42,
'precipType': 'rain',
'pressure': 985.5700000000001,
'summary': 'Mostly Cloudy',
'temperature': 2.68,
'time': 1520337600,
'uvIndex': 1,
'visibility': 8.34,
'windBearing': 73,
'windGust': 30.35,
'windSpeed': 15.19
},
{
'apparentTemperature': -1.53,
'cloudCover': 0.8100000000000001,
'dewPoint': 1.36,
'humidity': 0.89,
'icon': 'partly-cloudy-day',
'ozone': 474.17,
'precipIntensity': 0.3708,
'precipProbability': 0.42,
'precipType': 'rain',
'pressure': 985.48,
'summary': 'Mostly Cloudy',
'temperature': 3.01,
'time': 1520341200,
'uvIndex': 1,
'visibility': 7.57,
'windBearing': 72,
'windGust': 27.08,
'windSpeed': 12.91
},
{
'apparentTemperature': -0.42,
'cloudCover': 0.9399999999999999,
'dewPoint': 1.39,
'humidity': 0.87,
'icon': 'cloudy',
'ozone': 472.91,
'precipIntensity': 0.3683,
'precipProbability': 0.42,
'precipType': 'rain',
'pressure': 985.4,
'summary': 'Overcast',
'temperature': 3.33,
'time': 1520344800,
'uvIndex': 1,
'visibility': 6.68,
'windBearing': 71,
'windGust': 22.96,
'windSpeed': 9.83
},
{
'apparentTemperature': 0.64,
'cloudCover': 1,
'dewPoint': 1.37,
'humidity': 0.86,
'icon': 'cloudy',
'ozone': 470.53,
'precipIntensity': 0.3175,
'precipProbability': 0.38,
'precipType': 'rain',
'pressure': 985.38,
'summary': 'Overcast',
'temperature': 3.56,
'time': 1520348400,
'uvIndex': 0,
'visibility': 5.75,
'windBearing': 73,
'windGust': 18.37,
'windSpeed': 7.11
},
{
'apparentTemperature': 1.43,
'cloudCover': 1,
'dewPoint': 1.24,
'humidity': 0.85,
'icon': 'cloudy',
'ozone': 466.8,
'precipIntensity': 0.1727,
'precipProbability': 0.27,
'precipType': 'rain',
'pressure': 985.46,
'summary': 'Overcast',
'temperature': 3.55,
'time': 1520352000,
'uvIndex': 0,
'visibility': 5.37,
'windBearing': 84,
'windGust': 12.65,
'windSpeed': 5
},
{
'apparentTemperature': 2.18,
'cloudCover': 0.99,
'dewPoint': 1.04,
'humidity': 0.85,
'icon': 'cloudy',
'ozone': 461.98,
'precipIntensity': 0.0483,
'precipProbability': 0.15,
'precipType': 'rain',
'pressure': 985.62,
'summary': 'Overcast',
'temperature': 3.38,
'time': 1520355600,
'uvIndex': 0,
'visibility': 5.15,
'windBearing': 103,
'windGust': 6.47,
'windSpeed': 3.23
},
{
'apparentTemperature': 3.21,
'cloudCover': 0.98,
'dewPoint': 0.88,
'humidity': 0.85,
'icon': 'cloudy',
'ozone': 457.1,
'precipIntensity': 0.0127,
'precipProbability': 0.08,
'precipType': 'rain',
'pressure': 985.8200000000001,
'summary': 'Overcast',
'temperature': 3.21,
'time': 1520359200,
'uvIndex': 0,
'visibility': 4.93,
'windBearing': 125,
'windGust': 2.52,
'windSpeed': 2.13
},
{
'apparentTemperature': 3.17,
'cloudCover': 0.98,
'dewPoint': 0.79,
'humidity': 0.84,
'icon': 'cloudy',
'ozone': 451.76,
'precipIntensity': 0.0127,
'precipProbability': 0.08,
'precipType': 'rain',
'pressure': 986.09,
'summary': 'Overcast',
'temperature': 3.17,
'time': 1520362800,
'uvIndex': 0,
'visibility': 4.82,
'windBearing': 139,
'windGust': 2.35,
'windSpeed': 2.03
},
{
'apparentTemperature': 3.07,
'cloudCover': 0.98,
'dewPoint': 0.73,
'humidity': 0.85,
'icon': 'cloudy',
'ozone': 446.3,
'precipIntensity': 0.0279,
'precipProbability': 0.09,
'precipType': 'rain',
'pressure': 986.4299999999999,
'summary': 'Overcast',
'temperature': 3.07,
'time': 1520366400,
'uvIndex': 0,
'visibility': 4.7,
'windBearing': 146,
'windGust': 2.82,
'windSpeed': 2.59
},
{
'apparentTemperature': 1.81,
'cloudCover': 0.98,
'dewPoint': 0.6899999999999999,
'humidity': 0.85,
'icon': 'cloudy',
'ozone': 441.92,
'precipIntensity': 0.0457,
'precipProbability': 0.11,
'precipType': 'rain',
'pressure': 986.7,
'summary': 'Overcast',
'temperature': 2.97,
'time': 1520370000,
'uvIndex': 0,
'visibility': 4.59,
'windBearing': 151,
'windGust': 3.84,
'windSpeed': 3.09
},
{
'apparentTemperature': 1.55,
'cloudCover': 0.97,
'dewPoint': 0.68,
'humidity': 0.86,
'icon': 'cloudy',
'ozone': 439.27,
'precipIntensity': 0.0559,
'precipProbability': 0.12,
'precipType': 'rain',
'pressure': 986.9299999999999,
'summary': 'Overcast',
'temperature': 2.87,
'time': 1520373600,
'uvIndex': 0,
'visibility': 4.56,
'windBearing': 155,
'windGust': 4.9,
'windSpeed': 3.3
},
{
'apparentTemperature': 1.32,
'cloudCover': 0.96,
'dewPoint': 0.6899999999999999,
'humidity': 0.86,
'icon': 'cloudy',
'ozone': 437.81,
'precipIntensity': 0.06859999999999999,
'precipProbability': 0.13,
'precipType': 'rain',
'pressure': 987.11,
'summary': 'Overcast',
'temperature': 2.76,
'time': 1520377200,
'uvIndex': 0,
'visibility': 4.53,
'windBearing': 159,
'windGust': 6.09,
'windSpeed': 3.48
},
{
'apparentTemperature': 1.14,
'cloudCover': 0.9399999999999999,
'dewPoint': 0.63,
'humidity': 0.86,
'icon': 'cloudy',
'ozone': 437.02,
'precipIntensity': 0.0711,
'precipProbability': 0.14,
'precipType': 'rain',
'pressure': 987.22,
'summary': 'Overcast',
'temperature': 2.69,
'time': 1520380800,
'uvIndex': 0,
'visibility': 4.5,
'windBearing': 160,
'windGust': 6.74,
'windSpeed': 3.62
},
{
'apparentTemperature': 0.96,
'cloudCover': 0.92,
'dewPoint': 0.42,
'humidity': 0.86,
'icon': 'partly-cloudy-night',
'ozone': 437,
'precipIntensity': 0.061,
'precipProbability': 0.12,
'precipType': 'rain',
'pressure': 987.25,
'summary': 'Mostly Cloudy',
'temperature': 2.55,
'time': 1520384400,
'uvIndex': 0,
'visibility': 5.09,
'windBearing': 155,
'windGust': 6.11,
'windSpeed': 3.67
},
{
'apparentTemperature': 1.04,
'cloudCover': 0.88,
'dewPoint': 0.16,
'humidity': 0.84,
'icon': 'partly-cloudy-night',
'ozone': 437.55,
'precipIntensity': 0.0432,
'precipProbability': 0.11,
'precipType': 'rain',
'pressure': 987.21,
'summary': 'Mostly Cloudy',
'temperature': 2.61,
'time': 1520388000,
'uvIndex': 0,
'visibility': 5.68,
'windBearing': 148,
'windGust': 4.93,
'windSpeed': 3.65
},
{
'apparentTemperature': 1.06,
'cloudCover': 0.85,
'dewPoint': -0.03,
'humidity': 0.82,
'icon': 'partly-cloudy-night',
'ozone': 437.33,
'precipIntensity': 0.0305,
'precipProbability': 0.1,
'precipType': 'rain',
'pressure': 987.1799999999999,
'summary': 'Mostly Cloudy',
'temperature': 2.66,
'time': 1520391600,
'uvIndex': 0,
'visibility': 6.26,
'windBearing': 139,
'windGust': 4.8,
'windSpeed': 3.7
},
{
'apparentTemperature': 0.98,
'cloudCover': 0.83,
'dewPoint': -0.03,
'humidity': 0.82,
'icon': 'partly-cloudy-night',
'ozone': 435.15,
'precipIntensity': 0.0127,
'precipProbability': 0.07000000000000001,
'precipType': 'rain',
'pressure': 987.15,
'summary': 'Mostly Cloudy',
'temperature': 2.69,
'time': 1520395200,
'uvIndex': 0,
'visibility': 5.59,
'windBearing': 129,
'windGust': 6.67,
'windSpeed': 3.91
},
{
'apparentTemperature': 0.83,
'cloudCover': 0.8100000000000001,
'dewPoint': 0.08,
'humidity': 0.83,
'icon': 'partly-cloudy-night',
'ozone': 432.04,
'precipIntensity': 0.0152,
'precipProbability': 0.08,
'precipType': 'rain',
'pressure': 987.11,
'summary': 'Mostly Cloudy',
'temperature': 2.68,
'time': 1520398800,
'uvIndex': 0,
'visibility': 4.91,
'windBearing': 117,
'windGust': 9.56,
'windSpeed': 4.17
},
{
'apparentTemperature': 0.64,
'cloudCover': 0.8100000000000001,
'dewPoint': 0.24,
'humidity': 0.84,
'icon': 'partly-cloudy-night',
'ozone': 429.65,
'precipIntensity': 0.0279,
'precipProbability': 0.1,
'precipType': 'rain',
'pressure': 987.11,
'summary': 'Mostly Cloudy',
'temperature': 2.69,
'time': 1520402400,
'uvIndex': 0,
'visibility': 4.24,
'windBearing': 113,
'windGust': 12.14,
'windSpeed': 4.55
},
{
'apparentTemperature': 0.31,
'cloudCover': 0.86,
'dewPoint': 0.52,
'humidity': 0.86,
'icon': 'partly-cloudy-night',
'ozone': 428.59,
'precipIntensity': 0.066,
'precipProbability': 0.14,
'precipType': 'rain',
'pressure': 987.16,
'summary': 'Mostly Cloudy',
'temperature': 2.71,
'time': 1520406000,
'uvIndex': 0,
'visibility': 4.58,
'windBearing': 119,
'windGust': 13.96,
'windSpeed': 5.29
},
{
'apparentTemperature': -0.03,
'cloudCover': 0.92,
'dewPoint': 0.86,
'humidity': 0.87,
'icon': 'partly-cloudy-day',
'ozone': 428.16,
'precipIntensity': 0.2159,
'precipProbability': 0.25,
'precipType': 'rain',
'pressure': 987.24,
'summary': 'Mostly Cloudy',
'temperature': 2.73,
'time': 1520409600,
'uvIndex': 0,
'visibility': 4.92,
'windBearing': 133,
'windGust': 15.43,
'windSpeed': 6.2
},
{
'apparentTemperature': -0.21,
'cloudCover': 0.97,
'dewPoint': 1.16,
'humidity': 0.89,
'icon': 'cloudy',
'ozone': 427.97,
'precipIntensity': 0.3835,
'precipProbability': 0.33,
'precipType': 'rain',
'pressure': 987.39,
'summary': 'Overcast',
'temperature': 2.79,
'time': 1520413200,
'uvIndex': 0,
'visibility': 5.26,
'windBearing': 146,
'windGust': 16.6,
'windSpeed': 6.87
},
{
'apparentTemperature': -0.13,
'cloudCover': 0.99,
'dewPoint': 1.36,
'humidity': 0.9,
'icon': 'cloudy',
'ozone': 427.87,
'precipIntensity': 0.3708,
'precipProbability': 0.33,
'precipType': 'rain',
'pressure': 987.65,
'summary': 'Overcast',
'temperature': 2.91,
'time': 1520416800,
'uvIndex': 0,
'visibility': 6.48,
'windBearing': 155,
'windGust': 17.44,
'windSpeed': 7.04
},
{
'apparentTemperature': 0.33,
'cloudCover': 0.99,
'dewPoint': 1.51,
'humidity': 0.88,
'icon': 'cloudy',
'ozone': 428.09,
'precipIntensity': 0.2743,
'precipProbability': 0.3,
'precipType': 'rain',
'pressure': 987.95,
'summary': 'Overcast',
'temperature': 3.26,
'time': 1520420400,
'uvIndex': 1,
'visibility': 7.7,
'windBearing': 165,
'windGust': 17.98,
'windSpeed': 6.96
},
{
'apparentTemperature': 0.91,
'cloudCover': 0.98,
'dewPoint': 1.58,
'humidity': 0.86,
'icon': 'cloudy',
'ozone': 428.48,
'precipIntensity': 0.2235,
'precipProbability': 0.28,
'precipType': 'rain',
'pressure': 988.17,
'summary': 'Overcast',
'temperature': 3.73,
'time': 1520424000,
'uvIndex': 1,
'visibility': 8.92,
'windBearing': 171,
'windGust': 18.16,
'windSpeed': 6.93
},
{
'apparentTemperature': 2.09,
'cloudCover': 0.95,
'dewPoint': 1.59,
'humidity': 0.8,
'icon': 'cloudy',
'ozone': 428.92,
'precipIntensity': 0.2616,
'precipProbability': 0.31,
'precipType': 'rain',
'pressure': 988.1799999999999,
'summary': 'Overcast',
'temperature': 4.79,
'time': 1520427600,
'uvIndex': 1,
'visibility': 10,
'windBearing': 177,
'windGust': 17.87,
'windSpeed': 7.21
},
{
'apparentTemperature': 3.23,
'cloudCover': 0.9,
'dewPoint': 1.56,
'humidity': 0.74,
'icon': 'partly-cloudy-day',
'ozone': 429.52,
'precipIntensity': 0.3353,
'precipProbability': 0.35,
'precipType': 'rain',
'pressure': 988.09,
'summary': 'Mostly Cloudy',
'temperature': 5.83,
'time': 1520431200,
'uvIndex': 1,
'visibility': 10,
'windBearing': 181,
'windGust': 17.23,
'windSpeed': 7.58
},
{
'apparentTemperature': 4.03,
'cloudCover': 0.84,
'dewPoint': 1.37,
'humidity': 0.7,
'icon': 'partly-cloudy-day',
'ozone': 430.79,
'precipIntensity': 0.3556,
'precipProbability': 0.35,
'precipType': 'rain',
'pressure': 988.02,
'summary': 'Mostly Cloudy',
'temperature': 6.48,
'time': 1520434800,
'uvIndex': 0,
'visibility': 10,
'windBearing': 182,
'windGust': 16.68,
'windSpeed': 7.6
},
{
'apparentTemperature': 4.05,
'cloudCover': 0.78,
'dewPoint': 0.93,
'humidity': 0.68,
'icon': 'partly-cloudy-day',
'ozone': 433.58,
'precipIntensity': 0.2311,
'precipProbability': 0.29,
'precipType': 'rain',
'pressure': 987.99,
'summary': 'Mostly Cloudy',
'temperature': 6.36,
'time': 1520438400,
'uvIndex': 0,
'visibility': 10,
'windBearing': 180,
'windGust': 16.64,
'windSpeed': 7.01
},
{
'apparentTemperature': 3.72,
'cloudCover': 0.7,
'dewPoint': 0.32,
'humidity': 0.68,
'icon': 'partly-cloudy-day',
'ozone': 437.17,
'precipIntensity': 0.1016,
'precipProbability': 0.2,
'precipType': 'rain',
'pressure': 987.98,
'summary': 'Mostly Cloudy',
'temperature': 5.85,
'time': 1520442000,
'uvIndex': 0,
'visibility': 10,
'windBearing': 176,
'windGust': 16.67,
'windSpeed': 6.1
},
{
'apparentTemperature': 3.02,
'cloudCover': 0.65,
'dewPoint': -0.14,
'humidity': 0.6899999999999999,
'icon': 'partly-cloudy-night',
'ozone': 439.08,
'precipIntensity': 0.0533,
'precipProbability': 0.16,
'precipType': 'rain',
'pressure': 987.98,
'summary': 'Mostly Cloudy',
'temperature': 5.04,
'time': 1520445600,
'uvIndex': 0,
'visibility': 10,
'windBearing': 173,
'windGust': 15.87,
'windSpeed': 5.39
},
{
'apparentTemperature': 2.32,
'cloudCover': 0.61,
'dewPoint': -0.31,
'humidity': 0.72,
'icon': 'partly-cloudy-night',
'ozone': 438.11,
'precipIntensity': 0.0965,
'precipProbability': 0.19,
'precipType': 'rain',
'pressure': 988.08,
'summary': 'Mostly Cloudy',
'temperature': 4.31,
'time': 1520449200,
'uvIndex': 0,
'visibility': 10,
'windBearing': 171,
'windGust': 13.45,
'windSpeed': 5.01
},
{
'apparentTemperature': 1.39,
'cloudCover': 0.58,
'dewPoint': -0.36,
'humidity': 0.76,
'icon': 'partly-cloudy-night',
'ozone': 435.57,
'precipIntensity': 0.2311,
'precipProbability': 0.25,
'precipType': 'rain',
'pressure': 988.22,
'summary': 'Partly Cloudy',
'temperature': 3.43,
'time': 1520452800,
'uvIndex': 0,
'visibility': 10,
'windBearing': 170,
'windGust': 10.21,
'windSpeed': 4.8
},
{
'apparentTemperature': 0.68,
'cloudCover': 0.5600000000000001,
'dewPoint': -0.42,
'humidity': 0.79,
'icon': 'snow',
'ozone': 433.39,
'precipAccumulation': 0.287,
'precipIntensity': 0.3785,
'precipProbability': 0.29,
'precipType': 'snow',
'pressure': 988.3200000000001,
'summary': 'Possible Light Snow',
'temperature': 2.88,
'time': 1520456400,
'uvIndex': 0,
'visibility': 10,
'windBearing': 169,
'windGust': 7.7,
'windSpeed': 4.94
},
{
'apparentTemperature': -0.01,
'cloudCover': 0.55,
'dewPoint': -0.64,
'humidity': 0.79,
'icon': 'snow',
'ozone': 432.32,
'precipAccumulation': 0.343,
'precipIntensity': 0.4521,
'precipProbability': 0.3,
'precipType': 'snow',
'pressure': 988.36,
'summary': 'Light Snow',
'temperature': 2.58,
'time': 1520460000,
'uvIndex': 0,
'visibility': 10,
'windBearing': 168,
'windGust': 7.1,
'windSpeed': 5.7
},
{
'apparentTemperature': -0.67,
'cloudCover': 0.55,
'dewPoint': -0.89,
'humidity': 0.79,
'icon': 'snow',
'ozone': 431.57,
'precipAccumulation': 0.368,
'precipIntensity': 0.4851,
'precipProbability': 0.3,
'precipType': 'snow',
'pressure': 988.38,
'summary': 'Light Snow',
'temperature': 2.37,
'time': 1520463600,
'uvIndex': 0,
'visibility': 10,
'windBearing': 167,
'windGust': 7.48,
'windSpeed': 6.75
},
{
'apparentTemperature': -1.1,
'cloudCover': 0.5,
'dewPoint': -1.16,
'humidity': 0.78,
'icon': 'snow',
'ozone': 430.82,
'precipAccumulation': 0.333,
'precipIntensity': 0.4369,
'precipProbability': 0.27,
'precipType': 'snow',
'pressure': 988.33,
'summary': 'Possible Light Snow',
'temperature': 2.21,
'time': 1520467200,
'uvIndex': 0,
'visibility': 8.359999999999999,
'windBearing': 163,
'windGust': 7.84,
'windSpeed': 7.41
},
{
'apparentTemperature': -1.2,
'cloudCover': 0.36,
'dewPoint': -1.36,
'humidity': 0.78,
'icon': 'partly-cloudy-night',
'ozone': 429.65,
'precipAccumulation': 0.183,
'precipIntensity': 0.2388,
'precipProbability': 0.2,
'precipType': 'snow',
'pressure': 988.15,
'summary': 'Partly Cloudy',
'temperature': 2.11,
'time': 1520470800,
'uvIndex': 0,
'visibility': 8.58,
'windBearing': 155,
'windGust': 7.53,
'windSpeed': 7.38
},
{
'apparentTemperature': -1.1,
'cloudCover': 0.18,
'dewPoint': -1.56,
'humidity': 0.77,
'icon': 'clear-night',
'ozone': 428.38,
'precipAccumulation': 0.046,
'precipIntensity': 0.0584,
'precipProbability': 0.11,
'precipType': 'snow',
'pressure': 987.9,
'summary': 'Clear',
'temperature': 2.08,
'time': 1520474400,
'uvIndex': 0,
'visibility': 8.800000000000001,
'windBearing': 144,
'windGust': 7.17,
'windSpeed': 7
},
{
'apparentTemperature': -1.03,
'cloudCover': 0.05,
'dewPoint': -1.72,
'humidity': 0.76,
'icon': 'clear-night',
'ozone': 428.4,
'precipAccumulation': 0,
'precipIntensity': 0.0051,
'precipProbability': 0.04,
'precipType': 'snow',
'pressure': 987.6799999999999,
'summary': 'Clear',
'temperature': 2.03,
'time': 1520478000,
'uvIndex': 0,
'visibility': 9.02,
'windBearing': 135,
'windGust': 6.84,
'windSpeed': 6.66
},
{
'apparentTemperature': -1.19,
'cloudCover': 0.02,
'dewPoint': -1.92,
'humidity': 0.76,
'icon': 'clear-night',
'ozone': 430.33,
'precipAccumulation': 0,
'precipIntensity': 0.0025,
'precipProbability': 0.01,
'precipType': 'snow',
'pressure': 987.4400000000001,
'summary': 'Clear',
'temperature': 1.87,
'time': 1520481600,
'uvIndex': 0,
'visibility': 8.880000000000001,
'windBearing': 130,
'windGust': 6.71,
'windSpeed': 6.54
},
{
'apparentTemperature': -1.51,
'cloudCover': 0.03,
'dewPoint': -2.11,
'humidity': 0.76,
'icon': 'clear-night',
'ozone': 433.51,
'precipAccumulation': 0,
'precipIntensity': 0.0076,
'precipProbability': 0.04,
'precipType': 'snow',
'pressure': 987.24,
'summary': 'Clear',
'temperature': 1.58,
'time': 1520485200,
'uvIndex': 0,
'visibility': 8.73,
'windBearing': 126,
'windGust': 6.63,
'windSpeed': 6.47
},
{
'apparentTemperature': -1.58,
'cloudCover': 0.05,
'dewPoint': -2.09,
'humidity': 0.77,
'icon': 'clear-night',
'ozone': 437.17,
'precipAccumulation': 0.013,
'precipIntensity': 0.0152,
'precipProbability': 0.05,
'precipType': 'snow',
'pressure': 987.12,
'summary': 'Clear',
'temperature': 1.49,
'time': 1520488800,
'uvIndex': 0,
'visibility': 8.58,
'windBearing': 123,
'windGust': 6.51,
'windSpeed': 6.37
},
{
'apparentTemperature': -1.29,
'cloudCover': 0.08,
'dewPoint': -1.81,
'humidity': 0.78,
'icon': 'clear-day',
'ozone': 441.48,
'precipAccumulation': 0.018,
'precipIntensity': 0.0254,
'precipProbability': 0.08,
'precipType': 'snow',
'pressure': 987.17,
'summary': 'Clear',
'temperature': 1.67,
'time': 1520492400,
'uvIndex': 0,
'visibility': 8.83,
'windBearing': 120,
'windGust': 6.3,
'windSpeed': 6.18
},
{
'apparentTemperature': -0.76,
'cloudCover': 0.12,
'dewPoint': -1.31,
'humidity': 0.78,
'icon': 'clear-day',
'ozone': 446.27,
'precipAccumulation': 0.03,
'precipIntensity': 0.0406,
'precipProbability': 0.1,
'precipType': 'snow',
'pressure': 987.3200000000001,
'summary': 'Clear',
'temperature': 2.04,
'time': 1520496000,
'uvIndex': 0,
'visibility': 9.07,
'windBearing': 118,
'windGust': 6.06,
'windSpeed': 5.96
},
{
'apparentTemperature': -0.16,
'cloudCover': 0.14,
'dewPoint': -0.8100000000000001,
'humidity': 0.79,
'icon': 'clear-day',
'ozone': 449.97,
'precipIntensity': 0.0533,
'precipProbability': 0.13,
'precipType': 'rain',
'pressure': 987.49,
'summary': 'Clear',
'temperature': 2.46,
'time': 1520499600,
'uvIndex': 0,
'visibility': 9.32,
'windBearing': 119,
'windGust': 5.77,
'windSpeed': 5.7
},
{
'apparentTemperature': 0.68,
'cloudCover': 0.12,
'dewPoint': -0.31,
'humidity': 0.79,
'icon': 'clear-day',
'ozone': 451.87,
'precipIntensity': 0.0457,
'precipProbability': 0.13,
'precipType': 'rain',
'pressure': 987.66,
'summary': 'Clear',
'temperature': 3.03,
'time': 1520503200,
'uvIndex': 1,
'visibility': 9.34,
'windBearing': 125,
'windGust': 5.51,
'windSpeed': 5.34
},
{
'apparentTemperature': 1.84,
'cloudCover': 0.07000000000000001,
'dewPoint': 0.2,
'humidity': 0.77,
'icon': 'clear-day',
'ozone': 452.76,
'precipIntensity': 0.033,
'precipProbability': 0.13,
'precipType': 'rain',
'pressure': 987.8099999999999,
'summary': 'Clear',
'temperature': 3.88,
'time': 1520506800,
'uvIndex': 1,
'visibility': 9.35,
'windBearing': 135,
'windGust': 6.07,
'windSpeed': 4.97
}
],
'icon': 'partly-cloudy-night',
'summary': 'Mostly cloudy throughout the day.'
},
'latitude': 55.942,
'longitude': -4.556,
'offset': 0,
'timezone': 'Europe/London'
};
const goodOutput = {
'currently': {
'icon': 'rain',
'temperature': 2.62,
'summary': 'Light Rain',
'precip': 0.99,
'precipType': 'rain',
'tempMax': 3.92,
'tempMin': 1.54,
'windBearing': 73,
'windBearingRead': 'ENE'
},
'forcastToday': [{ 'time': '5 PM', 'icon': 'cloudy', 'temp': 3.38, 'precip': 0.15 }, {
'time': '6 PM',
'icon': 'cloudy',
'temp': 3.21,
'precip': 0.08
}, { 'time': '7 PM', 'icon': 'cloudy', 'temp': 3.17, 'precip': 0.08 }, {
'time': '8 PM',
'icon': 'cloudy',
'temp': 3.07,
'precip': 0.09
}, { 'time': '9 PM', 'icon': 'cloudy', 'temp': 2.97, 'precip': 0.11 }, {
'time': '10 PM',
'icon': 'cloudy',
'temp': 2.87,
'precip': 0.12
}, { 'time': '11 PM', 'icon': 'cloudy', 'temp': 2.76, 'precip': 0.13 }, {
'time': '12 AM',
'icon': 'cloudy',
'temp': 2.69,
'precip': 0.14
}, { 'time': '1 AM', 'icon': 'partly-cloudy-night', 'temp': 2.55, 'precip': 0.12 }, {
'time': '2 AM',
'icon': 'partly-cloudy-night',
'temp': 2.61,
'precip': 0.11
}, { 'time': '3 AM', 'icon': 'partly-cloudy-night', 'temp': 2.66, 'precip': 0.1 }, {
'time': '4 AM',
'icon': 'partly-cloudy-night',
'temp': 2.69,
'precip': 0.07
}, { 'time': '5 AM', 'icon': 'partly-cloudy-night', 'temp': 2.68, 'precip': 0.08 }, {
'time': '6 AM',
'icon': 'partly-cloudy-night',
'temp': 2.69,
'precip': 0.1
}, { 'time': '7 AM', 'icon': 'partly-cloudy-night', 'temp': 2.71, 'precip': 0.14 }, {
'time': '8 AM',
'icon': 'partly-cloudy-day',
'temp': 2.73,
'precip': 0.25
}, { 'time': '9 AM', 'icon': 'cloudy', 'temp': 2.79, 'precip': 0.33 }, {
'time': '10 AM',
'icon': 'cloudy',
'temp': 2.91,
'precip': 0.33
}, { 'time': '11 AM', 'icon': 'cloudy', 'temp': 3.26, 'precip': 0.3 }, {
'time': '12 PM',
'icon': 'cloudy',
'temp': 3.73,
'precip': 0.28
}, { 'time': '1 PM', 'icon': 'cloudy', 'temp': 4.79, 'precip': 0.31 }, {
'time': '2 PM',
'icon': 'partly-cloudy-day',
'temp': 5.83,
'precip': 0.35
}, { 'time': '3 PM', 'icon': 'partly-cloudy-day', 'temp': 6.48, 'precip': 0.35 }, {
'time': '4 PM',
'icon': 'partly-cloudy-day',
'temp': 6.36,
'precip': 0.29
}, { 'time': '5 PM', 'icon': 'partly-cloudy-day', 'temp': 5.85, 'precip': 0.2 }],
'dailyForecast': [{
'time': 'Wednesday',
'icon': 'snow',
'tempHigh': 6.48,
'tempLow': 1.49,
'precip': 0.67,
'precipType': 'rain'
}, {
'time': 'Thursday',
'icon': 'partly-cloudy-night',
'tempHigh': 7.3,
'tempLow': 2.41,
'precip': 0.58,
'precipType': 'rain'
}, {
'time': 'Friday',
'icon': 'partly-cloudy-day',
'tempHigh': 6.74,
'tempLow': 0.01,
'precip': 0.59,
'precipType': 'rain'
}, { 'time': 'Saturday', 'icon': 'snow', 'tempHigh': 5.78, 'tempLow': 1.51, 'precip': 0.51, 'precipType': 'snow' }, {
'time': 'Sunday',
'icon': 'snow',
'tempHigh': 6.12,
'tempLow': 1.58,
'precip': 0.77,
'precipType': 'rain'
}, { 'time': 'Monday', 'icon': 'wind', 'tempHigh': 4.83, 'tempLow': 2.88, 'precip': 0.67, 'precipType': 'rain' }, {
'time': 'Tuesday',
'icon': 'partly-cloudy-day',
'tempHigh': 7.32,
'tempLow': 3.44,
'precip': 0.42,
'precipType': 'rain'
}],
'details': {
'summary': 'Mixed precipitation today through Sunday, with temperatures rising to 7°C next Tuesday.',
'icon': 'rain',
'humidity': 0.89,
'visibility': 4.88,
'uvIndex': 1,
'sunriseTime': '06:58',
'sunsetTime': '18:03',
'moonphase': 'Waning gibbous',
'moonPhaseVal': 0.66,
'windSpeed': 9.23,
'pressure': 986.37
},
'time': 1520336355
};
describe('Weather', () => {
it('should gracefully handle no data', done => {
expect(reduceWeather()).to.eql({});
done();
});
xit('Should process data correctly', done => {
console.log(JSON.stringify(reduceWeather(requestData)));
expect(reduceWeather(requestData)).to.eql(goodOutput);
done();
});
});