This repository has been archived by the owner on Jan 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
18 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,21 @@ | ||
using DarkSky | ||
using Base.Test | ||
|
||
response = forecast(42.3601, -71.0589); | ||
@test typeof(response) === DarkSky.DarkSkyResponse | ||
response = forecast(42.3601, -71.0589, exclude=["currently"], extend="hourly"); | ||
@test typeof(response) === DarkSky.DarkSkyResponse | ||
response = forecast(42.3601, -71.0589, DateTime(2018, 1, 1, 0, 0, 0)); | ||
@test typeof(response) === DarkSky.DarkSkyResponse | ||
@test latitude(response) === 42.3601 | ||
@test longitude(response) === -71.0589 | ||
@test timezone(response) == "America/New_York" | ||
@test typeof(currently(response)) === Dict{String, Any} | ||
@test typeof(minutely(response)) === Dict{String, Any} | ||
@test typeof(daily(response)) === Dict{String, Any} | ||
@test typeof(alerts(response)) === Array{Any, 1} | ||
@test typeof(flags(response)) === Dict{String, Any} | ||
response = forecast(42.3601, -71.0589, DateTime(2018, 1, 1, 0, 0, 0), lang="es", units="si", exclude=["minutely"]); | ||
@test typeof(response) === DarkSky.DarkSkyResponse | ||
if haskey(ENV, "DARKSKY_API_KEY") | ||
info("Dark Sky API key was found in your system environment variables, running tests...") | ||
@test isa(forecast(42.3601, -71.0589), DarkSky.DarkSkyResponse) | ||
@test isa(forecast(42.3601, -71.0589, exclude=["currently"], extend="hourly"), DarkSky.DarkSkyResponse) | ||
response = forecast(42.3601, -71.0589, DateTime(2018, 1, 1, 0, 0, 0)); | ||
@test isa(response, DarkSky.DarkSkyResponse) | ||
@test latitude(response) === 42.3601 | ||
@test longitude(response) === -71.0589 | ||
@test timezone(response) == "America/New_York" | ||
@test isa(currently(response), Dict{String, Any}) | ||
@test isa(minutely(response), Dict{String, Any}) | ||
@test isa(daily(response), Dict{String, Any}) | ||
@test isa(alerts(response), Array{Any, 1}) | isa(alerts(response), Void) | ||
@test isa(flags(response), Dict{String, Any}) | ||
@test isa(forecast(42.3601, -71.0589, DateTime(2018, 1, 1, 0, 0, 0), lang="es", units="si", exclude=["minutely"]), DarkSky.DarkSkyResponse) | ||
else | ||
warn("Dark Sky API key was not found in your system environment variables, skipping tests...") | ||
end |