From f95d9a55802cc64219ffb919bc2069ba77e32e16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Menou?= Date: Thu, 19 Sep 2024 15:51:15 +0200 Subject: [PATCH] Meilleurs tests du controlleur de ressource (#4200) Testons une resource GTFS avec des erreurs de validation. --- .../controllers/resource_controller_test.exs | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/apps/transport/test/transport_web/controllers/resource_controller_test.exs b/apps/transport/test/transport_web/controllers/resource_controller_test.exs index 94ccf5abe0..3e2c89f4ef 100644 --- a/apps/transport/test/transport_web/controllers/resource_controller_test.exs +++ b/apps/transport/test/transport_web/controllers/resource_controller_test.exs @@ -353,7 +353,11 @@ defmodule TransportWeb.ResourceControllerTest do insert(:multi_validation, %{ resource_history_id: resource_history_id, validator: Transport.Validators.GTFSTransport.validator_name(), - result: %{}, + result: %{ + "NullDuration" => [%{"severity" => "Information"}], + "MissingCoordinates" => [%{"severity" => "Warning"}] + }, + max_error: "Warning", metadata: %DB.ResourceMetadata{ metadata: %{ "networks" => ["3CM", "RLV"], @@ -392,8 +396,8 @@ defmodule TransportWeb.ResourceControllerTest do assert content =~ ~s{Validation effectuée en utilisant le fichier GTFS en vigueur le 28/10/2022 à 16h12 Europe/Paris} - # Features are displayed in a table [ + # Features are displayed in a table {"table", [{"class", _}], [ {"thead", [], @@ -407,6 +411,19 @@ defmodule TransportWeb.ResourceControllerTest do ]} ]}, {"tbody", [], rows} + ]}, + # Issues are listed in a paginated table + {"table", [{"class", "table"}], + [ + {"tr", [], + [ + {"th", [], ["Type d'objet"]}, + {"th", [], ["Identifiant"]}, + {"th", [], ["Nom de l’objet"]}, + {"th", [], ["Identifiant associé"]}, + {"th", [], ["Détails"]} + ]}, + {"tr", [], _} ]} ] = content |> Floki.parse_document!() |> Floki.find("table")