diff --git a/app/models/communication/website/agenda/event/with_cal.rb b/app/models/communication/website/agenda/event/with_cal.rb
index 8e2f7870950db61086704012faedf13d8e936bc1..6fd24c245bef82e75cdb2824c77473b72e7d1c06 100644
--- a/app/models/communication/website/agenda/event/with_cal.rb
+++ b/app/models/communication/website/agenda/event/with_cal.rb
@@ -3,7 +3,7 @@ module Communication::Website::Agenda::Event::WithCal
 
   def cal
     @cal ||= AddToCalendar::URLs.new(
-      start_datetime: cal_from_time, 
+      start_datetime: cal_from_time,
       end_datetime: cal_to_time,
       timezone: timezone.name,
       all_day: cal_all_day,
@@ -21,6 +21,9 @@ module Communication::Website::Agenda::Event::WithCal
   end
 
   def cal_to_time
+    # Si all_day == true et qu'on ne transmet pas de date de fin, l'événement sera considéré comme un événement d'une journée
+    # On peut donc early return selon ces conditions
+    return if cal_all_day && from_day == to_day
     to_day.nil? ? cal_to_time_with_no_end_day
                 : cal_to_time_with_end_day
   end
@@ -37,7 +40,7 @@ module Communication::Website::Agenda::Event::WithCal
 
   def cal_to_time_with_end_day
     # Soit on a 1 heure de fin, et tout est simple
-    cal_end_time = to_hour 
+    cal_end_time = to_hour
     # Soit on n'en a pas, mais on a 1 heure de début, donc on ajoute 1 heure pour éviter les événements sans durée
     cal_end_time ||= from_hour + 1.hour if from_hour
     # Si rien n'a marché, on a nil
diff --git a/test/models/communication/website/agenda/event_test.rb b/test/models/communication/website/agenda/event_test.rb
index 17615a6e93fcf16c245551f9b7dee7689238f76e..7c2d08a12f0c46c07383699a708c6245987af70c 100644
--- a/test/models/communication/website/agenda/event_test.rb
+++ b/test/models/communication/website/agenda/event_test.rb
@@ -43,7 +43,102 @@
 require "test_helper"
 
 class Communication::Website::Agenda::EventTest < ActiveSupport::TestCase
-  # test "the truth" do
-  #   assert true
-  # end
+  test "valid cal file with specific dates and hours" do
+    event = new_event(
+      from_day: Date.tomorrow,
+      from_hour: "09:00",
+      to_day: Date.tomorrow + 1.day,
+      to_hour: "19:00"
+    )
+    assert(event.valid?)
+    assert_nothing_raised { event.cal }
+  end
+
+  test "valid cal file with specific hours on the same day" do
+    event = new_event(
+      from_day: Date.tomorrow,
+      from_hour: "09:00",
+      to_day: Date.tomorrow,
+      to_hour: "19:00"
+    )
+    assert(event.valid?)
+    assert_nothing_raised { event.cal }
+  end
+
+  test "valid cal file with specific hours but no end date" do
+    event = new_event(
+      from_day: Date.tomorrow,
+      from_hour: "09:00",
+      to_day: nil,
+      to_hour: "19:00"
+    )
+    assert(event.valid?)
+    assert_nothing_raised { event.cal }
+  end
+
+  test "valid cal file with specific dates but no end hour" do
+    event = new_event(
+      from_day: Date.tomorrow,
+      from_hour: "09:00",
+      to_day: Date.tomorrow + 1.day,
+      to_hour: nil
+    )
+    assert(event.valid?)
+    assert_nothing_raised { event.cal }
+  end
+
+  test "valid cal file on same day but no end hour" do
+    event = new_event(
+      from_day: Date.tomorrow,
+      from_hour: "09:00",
+      to_day: Date.tomorrow,
+      to_hour: nil
+    )
+    assert(event.valid?)
+    assert_nothing_raised { event.cal }
+  end
+
+  test "valid cal file on same day but no hours" do
+    event = new_event(
+      from_day: Date.tomorrow,
+      from_hour: nil,
+      to_day: Date.tomorrow,
+      to_hour: nil
+    )
+    assert(event.valid?)
+    assert_nothing_raised { event.cal }
+  end
+
+  test "valid cal file with specific dates but no hours" do
+    event = new_event(
+      from_day: Date.tomorrow,
+      from_hour: nil,
+      to_day: Date.tomorrow + 1.day,
+      to_hour: nil
+    )
+    assert(event.valid?)
+    assert_nothing_raised { event.cal }
+  end
+
+  test "valid cal file but no end" do
+    event = new_event(
+      from_day: Date.tomorrow,
+      from_hour: "09:00",
+      to_day: nil,
+      to_hour: nil
+    )
+    assert(event.valid?)
+    assert_nothing_raised { event.cal }
+  end
+
+  protected
+
+  def new_event(**options)
+    website_with_github.agenda_events.new(
+      title: "An event",
+      university_id: website_with_github.university_id,
+      language_id: website_with_github.default_language_id,
+      **options
+    )
+  end
 end