Fix backend tests

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-10-12 08:49:12 +02:00
parent 9621caf661
commit b383d11f51
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
7 changed files with 13 additions and 2 deletions

View File

@ -496,7 +496,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Event do
physical_address when is_map(physical_address) ->
TimezoneDetector.detect(
timezone,
physical_address.geom,
Map.get(physical_address, :geom),
fallback_tz
)

View File

@ -8,7 +8,9 @@ defmodule Mobilizon.Service.TimezoneDetector do
@doc """
Detect the most appropriate timezone from a value, a geographic set of coordinates and a fallback
"""
@spec detect(String.t() | nil, detectable(), String.t()) :: String.t()
@spec detect(String.t() | nil, detectable() | nil, String.t()) :: String.t()
def detect(tz, nil, fallback), do: detect(tz, fallback)
def detect(nil, geo, fallback) do
case TzWorld.timezone_at(geo) do
{:ok, timezone} ->

View File

@ -28,6 +28,7 @@ defmodule Mobilizon.Service.Geospatial.AddokTest do
region: "69, Rhône, Auvergne-Rhône-Alpes",
locality: "Lyon",
description: "10 Rue Jangot",
timezone: "Europe/Paris",
postal_code: "69007",
street: "10 Rue Jangot",
geom: %Geo.Point{coordinates: {4.842569, 45.751718}, properties: %{}, srid: 4326}
@ -54,6 +55,7 @@ defmodule Mobilizon.Service.Geospatial.AddokTest do
region: "69, Rhône, Auvergne-Rhône-Alpes",
locality: "Lyon",
description: "10 Rue Jangot",
timezone: "Europe/Paris",
postal_code: "69007",
street: "10 Rue Jangot",
geom: %Geo.Point{coordinates: {4.842569, 45.751718}, properties: %{}, srid: 4326}

View File

@ -69,6 +69,7 @@ defmodule Mobilizon.Service.Geospatial.GoogleMapsTest do
country: "France",
postal_code: "69007",
street: "10 Rue Jangot",
timezone: "Europe/Paris",
geom: %Geo.Point{
coordinates: {4.8424032, 45.75164940000001},
properties: %{},
@ -116,6 +117,7 @@ defmodule Mobilizon.Service.Geospatial.GoogleMapsTest do
country: "France",
postal_code: "69007",
street: "10bis Rue Jangot",
timezone: "Europe/Paris",
geom: %Geo.Point{
coordinates: {4.8424966, 45.751725},
properties: %{},

View File

@ -55,6 +55,7 @@ defmodule Mobilizon.Service.Geospatial.MapQuestTest do
country: "FR",
postal_code: "69007",
street: "10 Rue Jangot",
timezone: "Europe/Paris",
geom: %Geo.Point{
coordinates: {4.842566, 45.751714},
properties: %{},
@ -88,6 +89,7 @@ defmodule Mobilizon.Service.Geospatial.MapQuestTest do
country: "FR",
postal_code: "69007",
street: "10 Rue Jangot",
timezone: "Europe/Paris",
geom: %Geo.Point{
coordinates: {4.842569, 45.751718},
properties: %{},

View File

@ -31,6 +31,7 @@ defmodule Mobilizon.Service.Geospatial.NominatimTest do
country: "France",
postal_code: "69007",
street: "10 Rue Jangot",
timezone: "Europe/Paris",
geom: %Geo.Point{
coordinates: {4.8425657, 45.7517141},
properties: %{},
@ -66,6 +67,7 @@ defmodule Mobilizon.Service.Geospatial.NominatimTest do
country: "France",
postal_code: "69007",
street: "10 Rue Jangot",
timezone: "Europe/Paris",
geom: %Geo.Point{
coordinates: {4.8425657, 45.7517141},
properties: %{},

View File

@ -30,6 +30,7 @@ defmodule Mobilizon.Service.Geospatial.PhotonTest do
country: "France",
postal_code: "69007",
street: "10 Rue Jangot",
timezone: "Europe/Paris",
geom: %Geo.Point{
coordinates: {4.8425657, 45.7517141},
properties: %{},