Skip to content
Snippets Groups Projects
Commit 49ac4c86 authored by Reinder Kraaij's avatar Reinder Kraaij :eye:
Browse files

Corrected getTimelineItem tests to match output

parent 8ee1b3f3
No related branches found
No related tags found
1 merge request!1185TMSS: Updates Timeline test
...@@ -174,7 +174,7 @@ describe("getFieldsHtml", () => { ...@@ -174,7 +174,7 @@ describe("getFieldsHtml", () => {
const status = "scheduled"; const status = "scheduled";
const style = {color: "blue"}; const style = {color: "blue"};
let pagecontent;
act( () => { act( () => {
pagecontent = render(getFieldsHtml(fields, status, style)); pagecontent = render(getFieldsHtml(fields, status, style));
}); });
......
...@@ -176,6 +176,7 @@ describe("getTimelineItem", () => { ...@@ -176,6 +176,7 @@ describe("getTimelineItem", () => {
const suBlueprint = { const suBlueprint = {
id: "blueprint-id", id: "blueprint-id",
description:"test blueprint",
process_start_time: "2023-07-06T10:00:00Z", process_start_time: "2023-07-06T10:00:00Z",
on_sky_start_time: "2023-07-06T10:00:00Z", on_sky_start_time: "2023-07-06T10:00:00Z",
tasks: tasks, tasks: tasks,
...@@ -186,43 +187,48 @@ describe("getTimelineItem", () => { ...@@ -186,43 +187,48 @@ describe("getTimelineItem", () => {
on_sky_duration: 7200, on_sky_duration: 7200,
process_stop_time: "2023-07-06T12:00:00Z", process_stop_time: "2023-07-06T12:00:00Z",
on_sky_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, placed: true,
unschedulable_reason: "none", 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") const displayDate = moment("2023-07-06", "YYYY-MM-DD")
// TODO : Fix Unit test Returns the correct item object it("Returns the correct item object", () => {
it.skip("Returns the correct item object", () => {
const item = getTimelineItem(suBlueprint, displayDate); const item = getTimelineItem(suBlueprint, displayDate);
expect(item).toEqual({ expect(item).toEqual({
id: "blueprint-id-2023-07-06T10:00:00Z", id: "blueprint-id-27: Jul 06 - Thu",
suId: "blueprint-id", suId: "blueprint-id",
group: "Jul 06 Thu", group: "27: Jul 06 - Thu",
band :"antenna",
desc:"test blueprint",
title: "", title: "",
project: "bugs", project: "bugs",
name: "the_fix_1", name: "the_fix_1",
antenna_set: "antenna_set_value", antenna_set: "antenna_set_value",
scheduler: "fixed",
duration: "1.00Hrs", duration: "1.00Hrs",
on_sky_duration: "2.00Hrs", on_sky_duration: "2.00Hrs",
start_time: moment("2023-07-06 10:00:00Z"), start_time: moment("2023-07-06 10:00:00Z"),
end_time: moment("2023-07-06 12:00:00Z"), end_time: moment("2023-07-06 12:00:00Z"),
bgColor: STATUS_COLORS.DEFINED, real_start_time: "2023-07-06T12:01:00Z",
selectedBgColor: "none", real_end_time:"2023-07-06T12:02:00Z",
stations:"-",
type: "SCHEDULE", type: "SCHEDULE",
status: "defined", status: "defined",
placed: true, scheduler: "fixed",
unschedulable_reason: "none" 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", () => { it("returns the correct item object when antenna set is not provided", () => {
const suBlueprintWithoutAntennaSet = { let suBlueprintWithoutAntennaSet = {
...suBlueprint, ...suBlueprint,
tasks: [ tasks: [
{ {
...@@ -233,26 +239,31 @@ describe("getTimelineItem", () => { ...@@ -233,26 +239,31 @@ describe("getTimelineItem", () => {
} }
] ]
}; };
suBlueprintWithoutAntennaSet.antenna_set=undefined;
const item = getTimelineItem(suBlueprintWithoutAntennaSet, displayDate); const item = getTimelineItem(suBlueprintWithoutAntennaSet, displayDate);
expect(item).toEqual({ expect(item).toEqual({
id: "blueprint-id-2023-07-06T10:00:00Z", id: "blueprint-id-27: Jul 06 - Thu",
suId: "blueprint-id", suId: "blueprint-id",
group: "Jul 06 Thu", band :undefined,
desc:"test blueprint",
group: "27: Jul 06 - Thu",
title: "", title: "",
project: "bugs", project: "bugs",
name: "the_fix_1", name: "the_fix_1",
antenna_set: "", antenna_set: undefined,
scheduler: "fixed", scheduler: "fixed",
duration: "1.00Hrs", duration: "1.00Hrs",
stations:"-",
on_sky_duration: "2.00Hrs", on_sky_duration: "2.00Hrs",
start_time: moment("2023-07-06 10:00:00Z"), start_time: moment("2023-07-06 10:00:00Z"),
end_time: moment("2023-07-06 12:00:00Z"), end_time: moment("2023-07-06 12:00:00Z"),
bgColor: "#00BCD4", real_start_time: "2023-07-06T12:01:00Z",
selectedBgColor: "none", real_end_time:"2023-07-06T12:02:00Z",
type: "SCHEDULE", type: "SCHEDULE",
status: "defined", status: "defined",
placed: true,
unschedulable_reason: "none" unschedulable_reason: "none"
}); });
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment