import WeatherResponse from '../model/weather-response';
import WidgetViewModel, { weatherMatch, weatherType } from './widgetViewModel';

const testWeather = { "location": { "name": "Glentanner", "region": "", "country": "New Zealand", "lat": -43.73, "lon": 170.15, "tz_id": "Pacific/Auckland", "localtime_epoch": 1657488204, "localtime": "2022-07-11 9:23" }, "current": { "last_updated_epoch": 1657487700, "last_updated": "2022-07-11 09:15", "temp_c": -4.4, "temp_f": 24.1, "is_day": 1, "condition": { "text": "Clear", "icon": "//cdn.weatherapi.com/weather/64x64/day/113.png", "code": 1000 }, "wind_mph": 3.6, "wind_kph": 5.8, "wind_degree": 115, "wind_dir": "ESE", "pressure_mb": 1029.0, "pressure_in": 30.38, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 41, "cloud": 20, "feelslike_c": -7.0, "feelslike_f": 19.4, "vis_km": 10.0, "vis_miles": 6.0, "uv": 1.0, "gust_mph": 7.6, "gust_kph": 12.2, "air_quality": { "co": 210.3000030517578, "no2": 0.20000000298023224, "o3": 34.70000076293945, "so2": 0.0, "pm2_5": 0.5, "pm10": 0.8999999761581421, "us-epa-index": 1, "gb-defra-index": 1 } }, "forecast": { "forecastday": [{ "date": "2022-07-11", "date_epoch": 1657497600, "day": { "maxtemp_c": 2.0, "maxtemp_f": 35.6, "mintemp_c": -9.6, "mintemp_f": 14.7, "avgtemp_c": -4.5, "avgtemp_f": 23.8, "maxwind_mph": 6.3, "maxwind_kph": 10.1, "totalprecip_mm": 0.0, "totalprecip_in": 0.0, "avgvis_km": 10.0, "avgvis_miles": 6.0, "avghumidity": 72.0, "daily_will_it_rain": 0, "daily_chance_of_rain": 0, "daily_will_it_snow": 0, "daily_chance_of_snow": 0, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/day/116.png", "code": 1003 }, "uv": 2.0 }, "astro": { "sunrise": "08:10 AM", "sunset": "05:19 PM", "moonrise": "02:20 PM", "moonset": "05:08 AM", "moon_phase": "Waxing Gibbous", "moon_illumination": "84" }, "hour": [{ "time_epoch": 1657454400, "time": "2022-07-11 00:00", "temp_c": -9.6, "temp_f": 14.7, "is_day": 0, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/night/116.png", "code": 1003 }, "wind_mph": 5.8, "wind_kph": 9.4, "wind_degree": 129, "wind_dir": "SE", "pressure_mb": 1030.0, "pressure_in": 30.42, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 69, "cloud": 45, "feelslike_c": -14.6, "feelslike_f": 5.7, "windchill_c": -14.6, "windchill_f": 5.7, "heatindex_c": -9.6, "heatindex_f": 14.7, "dewpoint_c": -14.1, "dewpoint_f": 6.6, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 12.3, "gust_kph": 19.8, "uv": 1.0 }, { "time_epoch": 1657458000, "time": "2022-07-11 01:00", "temp_c": -8.8, "temp_f": 16.2, "is_day": 0, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/night/116.png", "code": 1003 }, "wind_mph": 4.9, "wind_kph": 7.9, "wind_degree": 130, "wind_dir": "SE", "pressure_mb": 1030.0, "pressure_in": 30.4, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 65, "cloud": 40, "feelslike_c": -13.0, "feelslike_f": 8.6, "windchill_c": -13.0, "windchill_f": 8.6, "heatindex_c": -8.8, "heatindex_f": 16.2, "dewpoint_c": -14.2, "dewpoint_f": 6.4, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 10.3, "gust_kph": 16.6, "uv": 1.0 }, { "time_epoch": 1657461600, "time": "2022-07-11 02:00", "temp_c": -8.6, "temp_f": 16.5, "is_day": 0, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/night/116.png", "code": 1003 }, "wind_mph": 4.9, "wind_kph": 7.9, "wind_degree": 129, "wind_dir": "SE", "pressure_mb": 1030.0, "pressure_in": 30.4, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 59, "cloud": 26, "feelslike_c": -12.8, "feelslike_f": 9.0, "windchill_c": -12.8, "windchill_f": 9.0, "heatindex_c": -8.6, "heatindex_f": 16.5, "dewpoint_c": -15.2, "dewpoint_f": 4.6, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 10.3, "gust_kph": 16.6, "uv": 1.0 }, { "time_epoch": 1657465200, "time": "2022-07-11 03:00", "temp_c": -8.2, "temp_f": 17.2, "is_day": 0, "condition": { "text": "Patchy light snow", "icon": "//cdn.weatherapi.com/weather/64x64/night/323.png", "code": 1210 }, "wind_mph": 4.3, "wind_kph": 6.8, "wind_degree": 123, "wind_dir": "ESE", "pressure_mb": 1029.0, "pressure_in": 30.39, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 55, "cloud": 34, "feelslike_c": -11.9, "feelslike_f": 10.6, "windchill_c": -11.9, "windchill_f": 10.6, "heatindex_c": -8.2, "heatindex_f": 17.2, "dewpoint_c": -15.7, "dewpoint_f": 3.7, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 8.9, "gust_kph": 14.4, "uv": 1.0 }, { "time_epoch": 1657468800, "time": "2022-07-11 04:00", "temp_c": -7.4, "temp_f": 18.7, "is_day": 0, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/night/116.png", "code": 1003 }, "wind_mph": 3.4, "wind_kph": 5.4, "wind_degree": 116, "wind_dir": "ESE", "pressure_mb": 1029.0, "pressure_in": 30.38, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 51, "cloud": 50, "feelslike_c": -10.2, "feelslike_f": 13.6, "windchill_c": -10.2, "windchill_f": 13.6, "heatindex_c": -7.4, "heatindex_f": 18.7, "dewpoint_c": -15.8, "dewpoint_f": 3.6, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 6.9, "gust_kph": 11.2, "uv": 1.0 }, { "time_epoch": 1657472400, "time": "2022-07-11 05:00", "temp_c": -7.0, "temp_f": 19.4, "is_day": 0, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/night/116.png", "code": 1003 }, "wind_mph": 4.3, "wind_kph": 6.8, "wind_degree": 125, "wind_dir": "SE", "pressure_mb": 1028.0, "pressure_in": 30.36, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 47, "cloud": 34, "feelslike_c": -10.5, "feelslike_f": 13.1, "windchill_c": -10.5, "windchill_f": 13.1, "heatindex_c": -7.0, "heatindex_f": 19.4, "dewpoint_c": -16.4, "dewpoint_f": 2.5, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 8.9, "gust_kph": 14.4, "uv": 1.0 }, { "time_epoch": 1657476000, "time": "2022-07-11 06:00", "temp_c": -8.0, "temp_f": 17.6, "is_day": 0, "condition": { "text": "Patchy light snow", "icon": "//cdn.weatherapi.com/weather/64x64/night/323.png", "code": 1210 }, "wind_mph": 4.0, "wind_kph": 6.5, "wind_degree": 120, "wind_dir": "ESE", "pressure_mb": 1028.0, "pressure_in": 30.37, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 41, "cloud": 29, "feelslike_c": -11.5, "feelslike_f": 11.3, "windchill_c": -11.5, "windchill_f": 11.3, "heatindex_c": -8.0, "heatindex_f": 17.6, "dewpoint_c": -19.0, "dewpoint_f": -2.2, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 8.5, "gust_kph": 13.7, "uv": 1.0 }, { "time_epoch": 1657479600, "time": "2022-07-11 07:00", "temp_c": -6.9, "temp_f": 19.6, "is_day": 0, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/night/116.png", "code": 1003 }, "wind_mph": 3.1, "wind_kph": 5.0, "wind_degree": 109, "wind_dir": "ESE", "pressure_mb": 1029.0, "pressure_in": 30.39, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 39, "cloud": 39, "feelslike_c": -9.4, "feelslike_f": 15.1, "windchill_c": -9.4, "windchill_f": 15.1, "heatindex_c": -6.9, "heatindex_f": 19.6, "dewpoint_c": -18.6, "dewpoint_f": -1.5, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 6.5, "gust_kph": 10.4, "uv": 1.0 }, { "time_epoch": 1657483200, "time": "2022-07-11 08:00", "temp_c": -4.4, "temp_f": 24.1, "is_day": 0, "condition": { "text": "Clear", "icon": "//cdn.weatherapi.com/weather/64x64/night/113.png", "code": 1000 }, "wind_mph": 3.6, "wind_kph": 5.8, "wind_degree": 115, "wind_dir": "ESE", "pressure_mb": 1029.0, "pressure_in": 30.38, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 41, "cloud": 20, "feelslike_c": -7.0, "feelslike_f": 19.4, "windchill_c": -7.0, "windchill_f": 19.4, "heatindex_c": -4.4, "heatindex_f": 24.1, "dewpoint_c": -15.8, "dewpoint_f": 3.6, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 7.6, "gust_kph": 12.2, "uv": 1.0 }, { "time_epoch": 1657486800, "time": "2022-07-11 09:00", "temp_c": -2.9, "temp_f": 26.8, "is_day": 1, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/day/116.png", "code": 1003 }, "wind_mph": 3.4, "wind_kph": 5.4, "wind_degree": 109, "wind_dir": "ESE", "pressure_mb": 1029.0, "pressure_in": 30.39, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 44, "cloud": 29, "feelslike_c": -5.1, "feelslike_f": 22.8, "windchill_c": -5.1, "windchill_f": 22.8, "heatindex_c": -2.9, "heatindex_f": 26.8, "dewpoint_c": -13.5, "dewpoint_f": 7.7, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 6.9, "gust_kph": 11.2, "uv": 2.0 }, { "time_epoch": 1657490400, "time": "2022-07-11 10:00", "temp_c": -0.7, "temp_f": 30.7, "is_day": 1, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/day/116.png", "code": 1003 }, "wind_mph": 2.9, "wind_kph": 4.7, "wind_degree": 113, "wind_dir": "ESE", "pressure_mb": 1028.0, "pressure_in": 30.37, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 56, "cloud": 33, "feelslike_c": -2.2, "feelslike_f": 28.0, "windchill_c": -2.2, "windchill_f": 28.0, "heatindex_c": -0.7, "heatindex_f": 30.7, "dewpoint_c": -8.4, "dewpoint_f": 16.9, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 5.6, "gust_kph": 9.0, "uv": 2.0 }, { "time_epoch": 1657494000, "time": "2022-07-11 11:00", "temp_c": 1.3, "temp_f": 34.3, "is_day": 1, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/day/116.png", "code": 1003 }, "wind_mph": 2.7, "wind_kph": 4.3, "wind_degree": 88, "wind_dir": "E", "pressure_mb": 1027.0, "pressure_in": 30.34, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 66, "cloud": 41, "feelslike_c": 0.2, "feelslike_f": 32.4, "windchill_c": 0.2, "windchill_f": 32.4, "heatindex_c": 1.3, "heatindex_f": 34.3, "dewpoint_c": -4.4, "dewpoint_f": 24.1, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 4.0, "gust_kph": 6.5, "uv": 2.0 }, { "time_epoch": 1657497600, "time": "2022-07-11 12:00", "temp_c": 2.2, "temp_f": 36.0, "is_day": 1, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/day/116.png", "code": 1003 }, "wind_mph": 2.2, "wind_kph": 3.6, "wind_degree": 87, "wind_dir": "E", "pressure_mb": 1027.0, "pressure_in": 30.31, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 76, "cloud": 46, "feelslike_c": 1.6, "feelslike_f": 34.9, "windchill_c": 1.6, "windchill_f": 34.9, "heatindex_c": 2.2, "heatindex_f": 36.0, "dewpoint_c": -1.6, "dewpoint_f": 29.1, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 2.7, "gust_kph": 4.3, "uv": 2.0 }, { "time_epoch": 1657501200, "time": "2022-07-11 13:00", "temp_c": 2.3, "temp_f": 36.1, "is_day": 1, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/day/116.png", "code": 1003 }, "wind_mph": 2.5, "wind_kph": 4.0, "wind_degree": 95, "wind_dir": "E", "pressure_mb": 1026.0, "pressure_in": 30.29, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 81, "cloud": 45, "feelslike_c": 1.5, "feelslike_f": 34.7, "windchill_c": 1.5, "windchill_f": 34.7, "heatindex_c": 2.3, "heatindex_f": 36.1, "dewpoint_c": -0.6, "dewpoint_f": 30.9, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 2.9, "gust_kph": 4.7, "uv": 2.0 }, { "time_epoch": 1657504800, "time": "2022-07-11 14:00", "temp_c": 2.1, "temp_f": 35.8, "is_day": 1, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/day/116.png", "code": 1003 }, "wind_mph": 3.1, "wind_kph": 5.0, "wind_degree": 121, "wind_dir": "ESE", "pressure_mb": 1025.0, "pressure_in": 30.27, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 84, "cloud": 46, "feelslike_c": 0.8, "feelslike_f": 33.4, "windchill_c": 0.8, "windchill_f": 33.4, "heatindex_c": 2.1, "heatindex_f": 35.8, "dewpoint_c": -0.2, "dewpoint_f": 31.6, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 3.6, "gust_kph": 5.8, "uv": 2.0 }, { "time_epoch": 1657508400, "time": "2022-07-11 15:00", "temp_c": 1.7, "temp_f": 35.1, "is_day": 1, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/day/116.png", "code": 1003 }, "wind_mph": 4.0, "wind_kph": 6.5, "wind_degree": 131, "wind_dir": "SE", "pressure_mb": 1024.0, "pressure_in": 30.25, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 87, "cloud": 43, "feelslike_c": -0.2, "feelslike_f": 31.6, "windchill_c": -0.2, "windchill_f": 31.6, "heatindex_c": 1.7, "heatindex_f": 35.1, "dewpoint_c": -0.3, "dewpoint_f": 31.5, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 5.1, "gust_kph": 8.3, "uv": 2.0 }, { "time_epoch": 1657512000, "time": "2022-07-11 16:00", "temp_c": 0.2, "temp_f": 32.4, "is_day": 1, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/day/116.png", "code": 1003 }, "wind_mph": 4.7, "wind_kph": 7.6, "wind_degree": 126, "wind_dir": "SE", "pressure_mb": 1025.0, "pressure_in": 30.26, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 83, "cloud": 46, "feelslike_c": -2.4, "feelslike_f": 27.7, "windchill_c": -2.4, "windchill_f": 27.7, "heatindex_c": 0.2, "heatindex_f": 32.4, "dewpoint_c": -2.3, "dewpoint_f": 27.9, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 8.1, "gust_kph": 13.0, "uv": 2.0 }, { "time_epoch": 1657515600, "time": "2022-07-11 17:00", "temp_c": -4.5, "temp_f": 23.9, "is_day": 1, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/day/116.png", "code": 1003 }, "wind_mph": 4.9, "wind_kph": 7.9, "wind_degree": 125, "wind_dir": "SE", "pressure_mb": 1026.0, "pressure_in": 30.28, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 82, "cloud": 28, "feelslike_c": -8.0, "feelslike_f": 17.6, "windchill_c": -8.0, "windchill_f": 17.6, "heatindex_c": -4.5, "heatindex_f": 23.9, "dewpoint_c": -7.1, "dewpoint_f": 19.2, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 10.3, "gust_kph": 16.6, "uv": 2.0 }, { "time_epoch": 1657519200, "time": "2022-07-11 18:00", "temp_c": -6.5, "temp_f": 20.3, "is_day": 0, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/night/116.png", "code": 1003 }, "wind_mph": 4.9, "wind_kph": 7.9, "wind_degree": 124, "wind_dir": "SE", "pressure_mb": 1026.0, "pressure_in": 30.3, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 82, "cloud": 26, "feelslike_c": -10.3, "feelslike_f": 13.5, "windchill_c": -10.3, "windchill_f": 13.5, "heatindex_c": -6.5, "heatindex_f": 20.3, "dewpoint_c": -9.1, "dewpoint_f": 15.6, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 10.3, "gust_kph": 16.6, "uv": 1.0 }, { "time_epoch": 1657522800, "time": "2022-07-11 19:00", "temp_c": -6.1, "temp_f": 21.0, "is_day": 0, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/night/116.png", "code": 1003 }, "wind_mph": 4.7, "wind_kph": 7.6, "wind_degree": 113, "wind_dir": "ESE", "pressure_mb": 1025.0, "pressure_in": 30.28, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 83, "cloud": 47, "feelslike_c": -9.7, "feelslike_f": 14.5, "windchill_c": -9.7, "windchill_f": 14.5, "heatindex_c": -6.1, "heatindex_f": 21.0, "dewpoint_c": -8.5, "dewpoint_f": 16.7, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 9.8, "gust_kph": 15.8, "uv": 1.0 }, { "time_epoch": 1657526400, "time": "2022-07-11 20:00", "temp_c": -5.4, "temp_f": 22.3, "is_day": 0, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/night/116.png", "code": 1003 }, "wind_mph": 4.7, "wind_kph": 7.6, "wind_degree": 120, "wind_dir": "ESE", "pressure_mb": 1025.0, "pressure_in": 30.28, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 84, "cloud": 47, "feelslike_c": -8.9, "feelslike_f": 16.0, "windchill_c": -8.9, "windchill_f": 16.0, "heatindex_c": -5.4, "heatindex_f": 22.3, "dewpoint_c": -7.7, "dewpoint_f": 18.1, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 9.8, "gust_kph": 15.8, "uv": 1.0 }, { "time_epoch": 1657530000, "time": "2022-07-11 21:00", "temp_c": -5.2, "temp_f": 22.6, "is_day": 0, "condition": { "text": "Overcast", "icon": "//cdn.weatherapi.com/weather/64x64/night/122.png", "code": 1009 }, "wind_mph": 5.1, "wind_kph": 8.3, "wind_degree": 132, "wind_dir": "SE", "pressure_mb": 1025.0, "pressure_in": 30.27, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 84, "cloud": 97, "feelslike_c": -8.9, "feelslike_f": 16.0, "windchill_c": -8.9, "windchill_f": 16.0, "heatindex_c": -5.2, "heatindex_f": 22.6, "dewpoint_c": -7.4, "dewpoint_f": 18.7, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 10.7, "gust_kph": 17.3, "uv": 1.0 }, { "time_epoch": 1657533600, "time": "2022-07-11 22:00", "temp_c": -4.7, "temp_f": 23.5, "is_day": 0, "condition": { "text": "Overcast", "icon": "//cdn.weatherapi.com/weather/64x64/night/122.png", "code": 1009 }, "wind_mph": 5.1, "wind_kph": 8.3, "wind_degree": 129, "wind_dir": "SE", "pressure_mb": 1024.0, "pressure_in": 30.23, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 85, "cloud": 100, "feelslike_c": -8.4, "feelslike_f": 16.9, "windchill_c": -8.4, "windchill_f": 16.9, "heatindex_c": -4.7, "heatindex_f": 23.5, "dewpoint_c": -6.8, "dewpoint_f": 19.8, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 10.7, "gust_kph": 17.3, "uv": 1.0 }, { "time_epoch": 1657537200, "time": "2022-07-11 23:00", "temp_c": -5.2, "temp_f": 22.6, "is_day": 0, "condition": { "text": "Overcast", "icon": "//cdn.weatherapi.com/weather/64x64/night/122.png", "code": 1009 }, "wind_mph": 5.4, "wind_kph": 8.6, "wind_degree": 126, "wind_dir": "SE", "pressure_mb": 1024.0, "pressure_in": 30.23, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 87, "cloud": 100, "feelslike_c": -9.1, "feelslike_f": 15.6, "windchill_c": -9.1, "windchill_f": 15.6, "heatindex_c": -5.2, "heatindex_f": 22.6, "dewpoint_c": -7.0, "dewpoint_f": 19.4, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 11.2, "gust_kph": 18.0, "uv": 1.0 }] }] } }


jest.mock("@arcgis/core/core/Accessor.js", () => {
    return jest.fn().mockImplementation(() => { });
});

jest.mock("@arcgis/core/core/accessorSupport/decorators.js", () => {
    return {
        property: jest.fn().mockImplementation(() => { })
    }
});

jest.mock("@arcgis/core/request.js", () => {
    const testWeather = { "location": { "name": "Glentanner", "region": "", "country": "New Zealand", "lat": -43.73, "lon": 170.15, "tz_id": "Pacific/Auckland", "localtime_epoch": 1657488204, "localtime": "2022-07-11 9:23" }, "current": { "last_updated_epoch": 1657487700, "last_updated": "2022-07-11 09:15", "temp_c": -4.4, "temp_f": 24.1, "is_day": 1, "condition": { "text": "Clear", "icon": "//cdn.weatherapi.com/weather/64x64/day/113.png", "code": 1000 }, "wind_mph": 3.6, "wind_kph": 5.8, "wind_degree": 115, "wind_dir": "ESE", "pressure_mb": 1029.0, "pressure_in": 30.38, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 41, "cloud": 20, "feelslike_c": -7.0, "feelslike_f": 19.4, "vis_km": 10.0, "vis_miles": 6.0, "uv": 1.0, "gust_mph": 7.6, "gust_kph": 12.2, "air_quality": { "co": 210.3000030517578, "no2": 0.20000000298023224, "o3": 34.70000076293945, "so2": 0.0, "pm2_5": 0.5, "pm10": 0.8999999761581421, "us-epa-index": 1, "gb-defra-index": 1 } }, "forecast": { "forecastday": [{ "date": "2022-07-11", "date_epoch": 1657497600, "day": { "maxtemp_c": 2.0, "maxtemp_f": 35.6, "mintemp_c": -9.6, "mintemp_f": 14.7, "avgtemp_c": -4.5, "avgtemp_f": 23.8, "maxwind_mph": 6.3, "maxwind_kph": 10.1, "totalprecip_mm": 0.0, "totalprecip_in": 0.0, "avgvis_km": 10.0, "avgvis_miles": 6.0, "avghumidity": 72.0, "daily_will_it_rain": 0, "daily_chance_of_rain": 0, "daily_will_it_snow": 0, "daily_chance_of_snow": 0, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/day/116.png", "code": 1003 }, "uv": 2.0 }, "astro": { "sunrise": "08:10 AM", "sunset": "05:19 PM", "moonrise": "02:20 PM", "moonset": "05:08 AM", "moon_phase": "Waxing Gibbous", "moon_illumination": "84" }, "hour": [{ "time_epoch": 1657454400, "time": "2022-07-11 00:00", "temp_c": -9.6, "temp_f": 14.7, "is_day": 0, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/night/116.png", "code": 1003 }, "wind_mph": 5.8, "wind_kph": 9.4, "wind_degree": 129, "wind_dir": "SE", "pressure_mb": 1030.0, "pressure_in": 30.42, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 69, "cloud": 45, "feelslike_c": -14.6, "feelslike_f": 5.7, "windchill_c": -14.6, "windchill_f": 5.7, "heatindex_c": -9.6, "heatindex_f": 14.7, "dewpoint_c": -14.1, "dewpoint_f": 6.6, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 12.3, "gust_kph": 19.8, "uv": 1.0 }, { "time_epoch": 1657458000, "time": "2022-07-11 01:00", "temp_c": -8.8, "temp_f": 16.2, "is_day": 0, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/night/116.png", "code": 1003 }, "wind_mph": 4.9, "wind_kph": 7.9, "wind_degree": 130, "wind_dir": "SE", "pressure_mb": 1030.0, "pressure_in": 30.4, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 65, "cloud": 40, "feelslike_c": -13.0, "feelslike_f": 8.6, "windchill_c": -13.0, "windchill_f": 8.6, "heatindex_c": -8.8, "heatindex_f": 16.2, "dewpoint_c": -14.2, "dewpoint_f": 6.4, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 10.3, "gust_kph": 16.6, "uv": 1.0 }, { "time_epoch": 1657461600, "time": "2022-07-11 02:00", "temp_c": -8.6, "temp_f": 16.5, "is_day": 0, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/night/116.png", "code": 1003 }, "wind_mph": 4.9, "wind_kph": 7.9, "wind_degree": 129, "wind_dir": "SE", "pressure_mb": 1030.0, "pressure_in": 30.4, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 59, "cloud": 26, "feelslike_c": -12.8, "feelslike_f": 9.0, "windchill_c": -12.8, "windchill_f": 9.0, "heatindex_c": -8.6, "heatindex_f": 16.5, "dewpoint_c": -15.2, "dewpoint_f": 4.6, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 10.3, "gust_kph": 16.6, "uv": 1.0 }, { "time_epoch": 1657465200, "time": "2022-07-11 03:00", "temp_c": -8.2, "temp_f": 17.2, "is_day": 0, "condition": { "text": "Patchy light snow", "icon": "//cdn.weatherapi.com/weather/64x64/night/323.png", "code": 1210 }, "wind_mph": 4.3, "wind_kph": 6.8, "wind_degree": 123, "wind_dir": "ESE", "pressure_mb": 1029.0, "pressure_in": 30.39, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 55, "cloud": 34, "feelslike_c": -11.9, "feelslike_f": 10.6, "windchill_c": -11.9, "windchill_f": 10.6, "heatindex_c": -8.2, "heatindex_f": 17.2, "dewpoint_c": -15.7, "dewpoint_f": 3.7, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 8.9, "gust_kph": 14.4, "uv": 1.0 }, { "time_epoch": 1657468800, "time": "2022-07-11 04:00", "temp_c": -7.4, "temp_f": 18.7, "is_day": 0, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/night/116.png", "code": 1003 }, "wind_mph": 3.4, "wind_kph": 5.4, "wind_degree": 116, "wind_dir": "ESE", "pressure_mb": 1029.0, "pressure_in": 30.38, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 51, "cloud": 50, "feelslike_c": -10.2, "feelslike_f": 13.6, "windchill_c": -10.2, "windchill_f": 13.6, "heatindex_c": -7.4, "heatindex_f": 18.7, "dewpoint_c": -15.8, "dewpoint_f": 3.6, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 6.9, "gust_kph": 11.2, "uv": 1.0 }, { "time_epoch": 1657472400, "time": "2022-07-11 05:00", "temp_c": -7.0, "temp_f": 19.4, "is_day": 0, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/night/116.png", "code": 1003 }, "wind_mph": 4.3, "wind_kph": 6.8, "wind_degree": 125, "wind_dir": "SE", "pressure_mb": 1028.0, "pressure_in": 30.36, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 47, "cloud": 34, "feelslike_c": -10.5, "feelslike_f": 13.1, "windchill_c": -10.5, "windchill_f": 13.1, "heatindex_c": -7.0, "heatindex_f": 19.4, "dewpoint_c": -16.4, "dewpoint_f": 2.5, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 8.9, "gust_kph": 14.4, "uv": 1.0 }, { "time_epoch": 1657476000, "time": "2022-07-11 06:00", "temp_c": -8.0, "temp_f": 17.6, "is_day": 0, "condition": { "text": "Patchy light snow", "icon": "//cdn.weatherapi.com/weather/64x64/night/323.png", "code": 1210 }, "wind_mph": 4.0, "wind_kph": 6.5, "wind_degree": 120, "wind_dir": "ESE", "pressure_mb": 1028.0, "pressure_in": 30.37, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 41, "cloud": 29, "feelslike_c": -11.5, "feelslike_f": 11.3, "windchill_c": -11.5, "windchill_f": 11.3, "heatindex_c": -8.0, "heatindex_f": 17.6, "dewpoint_c": -19.0, "dewpoint_f": -2.2, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 8.5, "gust_kph": 13.7, "uv": 1.0 }, { "time_epoch": 1657479600, "time": "2022-07-11 07:00", "temp_c": -6.9, "temp_f": 19.6, "is_day": 0, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/night/116.png", "code": 1003 }, "wind_mph": 3.1, "wind_kph": 5.0, "wind_degree": 109, "wind_dir": "ESE", "pressure_mb": 1029.0, "pressure_in": 30.39, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 39, "cloud": 39, "feelslike_c": -9.4, "feelslike_f": 15.1, "windchill_c": -9.4, "windchill_f": 15.1, "heatindex_c": -6.9, "heatindex_f": 19.6, "dewpoint_c": -18.6, "dewpoint_f": -1.5, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 6.5, "gust_kph": 10.4, "uv": 1.0 }, { "time_epoch": 1657483200, "time": "2022-07-11 08:00", "temp_c": -4.4, "temp_f": 24.1, "is_day": 0, "condition": { "text": "Clear", "icon": "//cdn.weatherapi.com/weather/64x64/night/113.png", "code": 1000 }, "wind_mph": 3.6, "wind_kph": 5.8, "wind_degree": 115, "wind_dir": "ESE", "pressure_mb": 1029.0, "pressure_in": 30.38, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 41, "cloud": 20, "feelslike_c": -7.0, "feelslike_f": 19.4, "windchill_c": -7.0, "windchill_f": 19.4, "heatindex_c": -4.4, "heatindex_f": 24.1, "dewpoint_c": -15.8, "dewpoint_f": 3.6, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 7.6, "gust_kph": 12.2, "uv": 1.0 }, { "time_epoch": 1657486800, "time": "2022-07-11 09:00", "temp_c": -2.9, "temp_f": 26.8, "is_day": 1, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/day/116.png", "code": 1003 }, "wind_mph": 3.4, "wind_kph": 5.4, "wind_degree": 109, "wind_dir": "ESE", "pressure_mb": 1029.0, "pressure_in": 30.39, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 44, "cloud": 29, "feelslike_c": -5.1, "feelslike_f": 22.8, "windchill_c": -5.1, "windchill_f": 22.8, "heatindex_c": -2.9, "heatindex_f": 26.8, "dewpoint_c": -13.5, "dewpoint_f": 7.7, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 6.9, "gust_kph": 11.2, "uv": 2.0 }, { "time_epoch": 1657490400, "time": "2022-07-11 10:00", "temp_c": -0.7, "temp_f": 30.7, "is_day": 1, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/day/116.png", "code": 1003 }, "wind_mph": 2.9, "wind_kph": 4.7, "wind_degree": 113, "wind_dir": "ESE", "pressure_mb": 1028.0, "pressure_in": 30.37, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 56, "cloud": 33, "feelslike_c": -2.2, "feelslike_f": 28.0, "windchill_c": -2.2, "windchill_f": 28.0, "heatindex_c": -0.7, "heatindex_f": 30.7, "dewpoint_c": -8.4, "dewpoint_f": 16.9, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 5.6, "gust_kph": 9.0, "uv": 2.0 }, { "time_epoch": 1657494000, "time": "2022-07-11 11:00", "temp_c": 1.3, "temp_f": 34.3, "is_day": 1, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/day/116.png", "code": 1003 }, "wind_mph": 2.7, "wind_kph": 4.3, "wind_degree": 88, "wind_dir": "E", "pressure_mb": 1027.0, "pressure_in": 30.34, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 66, "cloud": 41, "feelslike_c": 0.2, "feelslike_f": 32.4, "windchill_c": 0.2, "windchill_f": 32.4, "heatindex_c": 1.3, "heatindex_f": 34.3, "dewpoint_c": -4.4, "dewpoint_f": 24.1, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 4.0, "gust_kph": 6.5, "uv": 2.0 }, { "time_epoch": 1657497600, "time": "2022-07-11 12:00", "temp_c": 2.2, "temp_f": 36.0, "is_day": 1, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/day/116.png", "code": 1003 }, "wind_mph": 2.2, "wind_kph": 3.6, "wind_degree": 87, "wind_dir": "E", "pressure_mb": 1027.0, "pressure_in": 30.31, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 76, "cloud": 46, "feelslike_c": 1.6, "feelslike_f": 34.9, "windchill_c": 1.6, "windchill_f": 34.9, "heatindex_c": 2.2, "heatindex_f": 36.0, "dewpoint_c": -1.6, "dewpoint_f": 29.1, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 2.7, "gust_kph": 4.3, "uv": 2.0 }, { "time_epoch": 1657501200, "time": "2022-07-11 13:00", "temp_c": 2.3, "temp_f": 36.1, "is_day": 1, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/day/116.png", "code": 1003 }, "wind_mph": 2.5, "wind_kph": 4.0, "wind_degree": 95, "wind_dir": "E", "pressure_mb": 1026.0, "pressure_in": 30.29, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 81, "cloud": 45, "feelslike_c": 1.5, "feelslike_f": 34.7, "windchill_c": 1.5, "windchill_f": 34.7, "heatindex_c": 2.3, "heatindex_f": 36.1, "dewpoint_c": -0.6, "dewpoint_f": 30.9, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 2.9, "gust_kph": 4.7, "uv": 2.0 }, { "time_epoch": 1657504800, "time": "2022-07-11 14:00", "temp_c": 2.1, "temp_f": 35.8, "is_day": 1, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/day/116.png", "code": 1003 }, "wind_mph": 3.1, "wind_kph": 5.0, "wind_degree": 121, "wind_dir": "ESE", "pressure_mb": 1025.0, "pressure_in": 30.27, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 84, "cloud": 46, "feelslike_c": 0.8, "feelslike_f": 33.4, "windchill_c": 0.8, "windchill_f": 33.4, "heatindex_c": 2.1, "heatindex_f": 35.8, "dewpoint_c": -0.2, "dewpoint_f": 31.6, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 3.6, "gust_kph": 5.8, "uv": 2.0 }, { "time_epoch": 1657508400, "time": "2022-07-11 15:00", "temp_c": 1.7, "temp_f": 35.1, "is_day": 1, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/day/116.png", "code": 1003 }, "wind_mph": 4.0, "wind_kph": 6.5, "wind_degree": 131, "wind_dir": "SE", "pressure_mb": 1024.0, "pressure_in": 30.25, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 87, "cloud": 43, "feelslike_c": -0.2, "feelslike_f": 31.6, "windchill_c": -0.2, "windchill_f": 31.6, "heatindex_c": 1.7, "heatindex_f": 35.1, "dewpoint_c": -0.3, "dewpoint_f": 31.5, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 5.1, "gust_kph": 8.3, "uv": 2.0 }, { "time_epoch": 1657512000, "time": "2022-07-11 16:00", "temp_c": 0.2, "temp_f": 32.4, "is_day": 1, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/day/116.png", "code": 1003 }, "wind_mph": 4.7, "wind_kph": 7.6, "wind_degree": 126, "wind_dir": "SE", "pressure_mb": 1025.0, "pressure_in": 30.26, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 83, "cloud": 46, "feelslike_c": -2.4, "feelslike_f": 27.7, "windchill_c": -2.4, "windchill_f": 27.7, "heatindex_c": 0.2, "heatindex_f": 32.4, "dewpoint_c": -2.3, "dewpoint_f": 27.9, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 8.1, "gust_kph": 13.0, "uv": 2.0 }, { "time_epoch": 1657515600, "time": "2022-07-11 17:00", "temp_c": -4.5, "temp_f": 23.9, "is_day": 1, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/day/116.png", "code": 1003 }, "wind_mph": 4.9, "wind_kph": 7.9, "wind_degree": 125, "wind_dir": "SE", "pressure_mb": 1026.0, "pressure_in": 30.28, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 82, "cloud": 28, "feelslike_c": -8.0, "feelslike_f": 17.6, "windchill_c": -8.0, "windchill_f": 17.6, "heatindex_c": -4.5, "heatindex_f": 23.9, "dewpoint_c": -7.1, "dewpoint_f": 19.2, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 10.3, "gust_kph": 16.6, "uv": 2.0 }, { "time_epoch": 1657519200, "time": "2022-07-11 18:00", "temp_c": -6.5, "temp_f": 20.3, "is_day": 0, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/night/116.png", "code": 1003 }, "wind_mph": 4.9, "wind_kph": 7.9, "wind_degree": 124, "wind_dir": "SE", "pressure_mb": 1026.0, "pressure_in": 30.3, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 82, "cloud": 26, "feelslike_c": -10.3, "feelslike_f": 13.5, "windchill_c": -10.3, "windchill_f": 13.5, "heatindex_c": -6.5, "heatindex_f": 20.3, "dewpoint_c": -9.1, "dewpoint_f": 15.6, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 10.3, "gust_kph": 16.6, "uv": 1.0 }, { "time_epoch": 1657522800, "time": "2022-07-11 19:00", "temp_c": -6.1, "temp_f": 21.0, "is_day": 0, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/night/116.png", "code": 1003 }, "wind_mph": 4.7, "wind_kph": 7.6, "wind_degree": 113, "wind_dir": "ESE", "pressure_mb": 1025.0, "pressure_in": 30.28, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 83, "cloud": 47, "feelslike_c": -9.7, "feelslike_f": 14.5, "windchill_c": -9.7, "windchill_f": 14.5, "heatindex_c": -6.1, "heatindex_f": 21.0, "dewpoint_c": -8.5, "dewpoint_f": 16.7, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 9.8, "gust_kph": 15.8, "uv": 1.0 }, { "time_epoch": 1657526400, "time": "2022-07-11 20:00", "temp_c": -5.4, "temp_f": 22.3, "is_day": 0, "condition": { "text": "Partly cloudy", "icon": "//cdn.weatherapi.com/weather/64x64/night/116.png", "code": 1003 }, "wind_mph": 4.7, "wind_kph": 7.6, "wind_degree": 120, "wind_dir": "ESE", "pressure_mb": 1025.0, "pressure_in": 30.28, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 84, "cloud": 47, "feelslike_c": -8.9, "feelslike_f": 16.0, "windchill_c": -8.9, "windchill_f": 16.0, "heatindex_c": -5.4, "heatindex_f": 22.3, "dewpoint_c": -7.7, "dewpoint_f": 18.1, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 9.8, "gust_kph": 15.8, "uv": 1.0 }, { "time_epoch": 1657530000, "time": "2022-07-11 21:00", "temp_c": -5.2, "temp_f": 22.6, "is_day": 0, "condition": { "text": "Overcast", "icon": "//cdn.weatherapi.com/weather/64x64/night/122.png", "code": 1009 }, "wind_mph": 5.1, "wind_kph": 8.3, "wind_degree": 132, "wind_dir": "SE", "pressure_mb": 1025.0, "pressure_in": 30.27, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 84, "cloud": 97, "feelslike_c": -8.9, "feelslike_f": 16.0, "windchill_c": -8.9, "windchill_f": 16.0, "heatindex_c": -5.2, "heatindex_f": 22.6, "dewpoint_c": -7.4, "dewpoint_f": 18.7, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 10.7, "gust_kph": 17.3, "uv": 1.0 }, { "time_epoch": 1657533600, "time": "2022-07-11 22:00", "temp_c": -4.7, "temp_f": 23.5, "is_day": 0, "condition": { "text": "Overcast", "icon": "//cdn.weatherapi.com/weather/64x64/night/122.png", "code": 1009 }, "wind_mph": 5.1, "wind_kph": 8.3, "wind_degree": 129, "wind_dir": "SE", "pressure_mb": 1024.0, "pressure_in": 30.23, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 85, "cloud": 100, "feelslike_c": -8.4, "feelslike_f": 16.9, "windchill_c": -8.4, "windchill_f": 16.9, "heatindex_c": -4.7, "heatindex_f": 23.5, "dewpoint_c": -6.8, "dewpoint_f": 19.8, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 10.7, "gust_kph": 17.3, "uv": 1.0 }, { "time_epoch": 1657537200, "time": "2022-07-11 23:00", "temp_c": -5.2, "temp_f": 22.6, "is_day": 0, "condition": { "text": "Overcast", "icon": "//cdn.weatherapi.com/weather/64x64/night/122.png", "code": 1009 }, "wind_mph": 5.4, "wind_kph": 8.6, "wind_degree": 126, "wind_dir": "SE", "pressure_mb": 1024.0, "pressure_in": 30.23, "precip_mm": 0.0, "precip_in": 0.0, "humidity": 87, "cloud": 100, "feelslike_c": -9.1, "feelslike_f": 15.6, "windchill_c": -9.1, "windchill_f": 15.6, "heatindex_c": -5.2, "heatindex_f": 22.6, "dewpoint_c": -7.0, "dewpoint_f": 19.4, "will_it_rain": 0, "chance_of_rain": 0, "will_it_snow": 0, "chance_of_snow": 0, "vis_km": 10.0, "vis_miles": 6.0, "gust_mph": 11.2, "gust_kph": 18.0, "uv": 1.0 }] }] } }

    return jest.fn().mockResolvedValue({ data: testWeather })
       
});





describe('Widget View Model Tests', function () {

    let vm: WidgetViewModel;

    beforeEach(() => {

        vm = new WidgetViewModel({
            weatherAPI: "",
            weatherURL: "",
            view: undefined
        })

    });

    it('gets the correct cloud cover', () => {
        let cloudCover = vm.getCloud();
        expect(cloudCover).toEqual(0);
        let weather = new WeatherResponse(testWeather);
        vm.currentWeather = weather;
        cloudCover = vm.getCloud();
        expect(cloudCover).toEqual(0.2);
    });


    it('gets the correct fog cover', () => {
        let fogCover = vm.getFogCover();
        expect(fogCover).toEqual(0.5);
    });


    it('gets the correct precipation', () => {


        let rainfall = vm.getPrecipitation(weatherMatch[0]);
        expect(rainfall).toEqual(0);
        //Heavy
        rainfall = vm.getPrecipitation(weatherMatch[17]);
        expect(rainfall).toEqual(90);
        //Thundery
        rainfall = vm.getPrecipitation(weatherMatch[9]);
        expect(rainfall).toEqual(30);
        //patchy
        rainfall = vm.getPrecipitation(weatherMatch[5]);
        expect(rainfall).toEqual(30);
        //blowing
        rainfall = vm.getPrecipitation(weatherMatch[10]);
        expect(rainfall).toEqual(30);
        //blizzrd
        rainfall = vm.getPrecipitation(weatherMatch[11]);
        expect(rainfall).toEqual(100);
        //light
        rainfall = vm.getPrecipitation(weatherMatch[15]);
        expect(rainfall).toEqual(30);
        //drizzle
        rainfall = vm.getPrecipitation(weatherMatch[16]);
        expect(rainfall).toEqual(30);
        //moderate
        rainfall = vm.getPrecipitation(weatherMatch[20]);
        expect(rainfall).toEqual(60);
        //pellets
        rainfall = vm.getPrecipitation(weatherMatch[34]);
        expect(rainfall).toEqual(30);
        //torrential
        rainfall = vm.getPrecipitation(weatherMatch[37]);
        expect(rainfall).toEqual(100);


    });

    it('gets the weather correctly', () => {
        let cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.SUNNY);

        let weather = new WeatherResponse(testWeather);
        vm.currentWeather = weather;

        vm.currentWeather.current.condition.code = 1;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.SUNNY);

        vm.currentWeather.current.condition.code = 1000;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.SUNNY);

        vm.currentWeather.current.condition.code = 1003;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.SUNNY);

        vm.currentWeather.current.condition.code = 1006;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.CLOUDY);

        vm.currentWeather.current.condition.code = 1009;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.CLOUDY);

        vm.currentWeather.current.condition.code = 1030;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.FOGGY);

        vm.currentWeather.current.condition.code = 1063;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.RAINY);

        vm.currentWeather.current.condition.code = 1066;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.SNOWY);

        vm.currentWeather.current.condition.code = 1069;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.SNOWY);

        vm.currentWeather.current.condition.code = 1072;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.SNOWY);

        vm.currentWeather.current.condition.code = 1087;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.RAINY);

        vm.currentWeather.current.condition.code = 1114;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.SNOWY);

        vm.currentWeather.current.condition.code = 1117;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.SNOWY);

        vm.currentWeather.current.condition.code = 1135;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.FOGGY);

        vm.currentWeather.current.condition.code = 1147;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.FOGGY);

        vm.currentWeather.current.condition.code = 1150;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.RAINY);

        vm.currentWeather.current.condition.code = 1153;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.RAINY);

        vm.currentWeather.current.condition.code = 1168;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.SNOWY);

        vm.currentWeather.current.condition.code = 1171;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.SNOWY);

        vm.currentWeather.current.condition.code = 1180;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.RAINY);

        vm.currentWeather.current.condition.code = 1183;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.RAINY);

        vm.currentWeather.current.condition.code = 1186;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.RAINY);

        vm.currentWeather.current.condition.code = 1189;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.RAINY);

        vm.currentWeather.current.condition.code = 1192;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.RAINY);

        vm.currentWeather.current.condition.code = 1195;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.RAINY);

        vm.currentWeather.current.condition.code = 1198;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.RAINY);

        vm.currentWeather.current.condition.code = 1201;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.RAINY);

        vm.currentWeather.current.condition.code = 1204;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.SNOWY);

        vm.currentWeather.current.condition.code = 1207;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.SNOWY);

        vm.currentWeather.current.condition.code = 1210;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.SNOWY);

        vm.currentWeather.current.condition.code = 1213;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.SNOWY);

        vm.currentWeather.current.condition.code = 1216;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.SNOWY);

        vm.currentWeather.current.condition.code = 1219;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.SNOWY);

        vm.currentWeather.current.condition.code = 1222;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.SNOWY);

        vm.currentWeather.current.condition.code = 1225;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.SNOWY);

        vm.currentWeather.current.condition.code = 1237;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.SNOWY);

        vm.currentWeather.current.condition.code = 1240;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.RAINY);

        vm.currentWeather.current.condition.code = 1243;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.RAINY);

        vm.currentWeather.current.condition.code = 1246;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.RAINY);

        vm.currentWeather.current.condition.code = 1249;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.RAINY);

        vm.currentWeather.current.condition.code = 1252;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.RAINY);

        vm.currentWeather.current.condition.code = 1255;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.RAINY);

        vm.currentWeather.current.condition.code = 1258;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.RAINY);

        vm.currentWeather.current.condition.code = 1261;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.RAINY);

        vm.currentWeather.current.condition.code = 1264;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.RAINY);

        vm.currentWeather.current.condition.code = 1273;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.RAINY);

        vm.currentWeather.current.condition.code = 1276;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.SNOWY);

        vm.currentWeather.current.condition.code = 1279;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.SNOWY);

        vm.currentWeather.current.condition.code = 1282;
        cw = vm.getWeather();
        expect(cw.type).toEqual(weatherType.SNOWY);



    });

    it("Sets the environment", () => {
        let weather = new WeatherResponse(testWeather);
        vm.currentWeather = weather;
        vm.setEnvironment();

    })

    it("calls get latest weather", () => {
        vm.getLatestWeather(1, 1);
    });


})
