From 49ac4c86f98f65916897f9242a76005bbf6f440f Mon Sep 17 00:00:00 2001
From: kraaij <kraaij@astron.nl>
Date: Thu, 19 Oct 2023 00:51:09 +0200
Subject: [PATCH] Corrected getTimelineItem tests to match output

---
 .../components/TimelineItemPopover.test.js    |  2 +-
 .../helpers/toolbar/filters.helper.test.js    | 47 ++++++++++++-------
 2 files changed, 30 insertions(+), 19 deletions(-)

diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/components/TimelineItemPopover.test.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/components/TimelineItemPopover.test.js
index ee77959f71f..7d9823e8e73 100644
--- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/components/TimelineItemPopover.test.js
+++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/components/TimelineItemPopover.test.js
@@ -174,7 +174,7 @@ describe("getFieldsHtml", () => {
         const status = "scheduled";
         const style = {color: "blue"};
 
-
+        let pagecontent;
         act( () => {
                     pagecontent = render(getFieldsHtml(fields, status, style));
         });
diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/helpers/toolbar/filters.helper.test.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/helpers/toolbar/filters.helper.test.js
index 243ffd7f86c..5bf70bf3d4f 100644
--- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/helpers/toolbar/filters.helper.test.js
+++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/helpers/toolbar/filters.helper.test.js
@@ -176,6 +176,7 @@ describe("getTimelineItem", () => {
 
     const suBlueprint = {
         id: "blueprint-id",
+        description:"test blueprint",
         process_start_time: "2023-07-06T10:00:00Z",
         on_sky_start_time: "2023-07-06T10:00:00Z",
         tasks: tasks,
@@ -186,43 +187,48 @@ describe("getTimelineItem", () => {
         on_sky_duration: 7200,
         process_stop_time: "2023-07-06T12:00:00Z",
         on_sky_stop_time: "2023-07-06T12:00:00Z",
+        real_start_time: "2023-07-06T12:01:00Z",
+        real_end_time:"2023-07-06T12:02:00Z",
         placed: true,
         unschedulable_reason: "none",
-        scheduling_constraints_doc: { scheduler: "fixed" }
+        scheduling_constraints_doc: { scheduler: "fixed" },
+        antenna_set:"antenna_set_value",
+        scheduler:"fixed"
     };
 
     const displayDate = moment("2023-07-06", "YYYY-MM-DD")
 
-    // TODO : Fix Unit test Returns the correct item object
-    it.skip("Returns the correct item object", () => {
+    it("Returns the correct item object", () => {
         const item = getTimelineItem(suBlueprint, displayDate);
 
         expect(item).toEqual({
-            id: "blueprint-id-2023-07-06T10:00:00Z",
+            id: "blueprint-id-27: Jul 06 - Thu",
             suId: "blueprint-id",
-            group: "Jul 06 Thu",
+            group: "27: Jul 06 - Thu",
+            band :"antenna",
+            desc:"test blueprint",
             title: "",
             project: "bugs",
             name: "the_fix_1",
             antenna_set: "antenna_set_value",
-            scheduler: "fixed",
             duration: "1.00Hrs",
             on_sky_duration: "2.00Hrs",
             start_time: moment("2023-07-06 10:00:00Z"),
             end_time: moment("2023-07-06 12:00:00Z"),
-            bgColor: STATUS_COLORS.DEFINED,
-            selectedBgColor: "none",
+            real_start_time: "2023-07-06T12:01:00Z",
+            real_end_time:"2023-07-06T12:02:00Z",
+            stations:"-",
             type: "SCHEDULE",
             status: "defined",
-            placed: true,
+            scheduler: "fixed",
             unschedulable_reason: "none"
         });
     });
 
 
-    // TODO : Fix Unit Test returns the correct item object when antenna set is not provided
-    it.skip("returns the correct item object when antenna set is not provided", () => {
-        const suBlueprintWithoutAntennaSet = {
+    
+    it("returns the correct item object when antenna set is not provided", () => {
+        let suBlueprintWithoutAntennaSet = {
             ...suBlueprint,
             tasks: [
                 {
@@ -233,26 +239,31 @@ describe("getTimelineItem", () => {
                 }
             ]
         };
+        suBlueprintWithoutAntennaSet.antenna_set=undefined;
         const item = getTimelineItem(suBlueprintWithoutAntennaSet, displayDate);
 
         expect(item).toEqual({
-            id: "blueprint-id-2023-07-06T10:00:00Z",
+            id: "blueprint-id-27: Jul 06 - Thu",
             suId: "blueprint-id",
-            group: "Jul 06 Thu",
+            band :undefined,
+            desc:"test blueprint",
+            group: "27: Jul 06 - Thu",
             title: "",
             project: "bugs",
             name: "the_fix_1",
-            antenna_set: "",
+            antenna_set: undefined,
             scheduler: "fixed",
             duration: "1.00Hrs",
+            stations:"-",
             on_sky_duration: "2.00Hrs",
             start_time: moment("2023-07-06 10:00:00Z"),
             end_time: moment("2023-07-06 12:00:00Z"),
-            bgColor: "#00BCD4",
-            selectedBgColor: "none",
+            real_start_time: "2023-07-06T12:01:00Z",
+            real_end_time:"2023-07-06T12:02:00Z",
+
             type: "SCHEDULE",
             status: "defined",
-            placed: true,
+    
             unschedulable_reason: "none"
         });
     });
-- 
GitLab