Adjust on getAggregateWorkingHours (#15137)

Co-authored-by: Keith Williams <keithwillcode@gmail.com>
This commit is contained in:
Vinicius Vieira
2024-05-31 04:01:11 +00:00
committed by GitHub
co-authored by Keith Williams
parent 3b1de34451
commit 7434d91d48
+21 -7
View File
@@ -20,12 +20,14 @@ describe("getAggregateWorkingHours", () => {
timeZone: "Europe/London",
workingHours,
dateOverrides: [],
datesOutOfOffice: {},
},
{
busy: [],
timeZone: "Europe/London",
workingHours,
dateOverrides: [],
datesOutOfOffice: {},
},
],
null
@@ -49,12 +51,14 @@ describe("getAggregateWorkingHours", () => {
timeZone: "Europe/London",
workingHours,
dateOverrides: [],
datesOutOfOffice: {},
},
{
busy: [],
timeZone: "Europe/London",
workingHours,
dateOverrides: [],
datesOutOfOffice: {},
},
],
"MANAGED"
@@ -85,6 +89,7 @@ describe("getAggregateWorkingHours", () => {
timeZone: "Europe/London",
workingHours: workingHoursA,
dateOverrides: [],
datesOutOfOffice: {},
user: {
isFixed: false,
},
@@ -94,6 +99,7 @@ describe("getAggregateWorkingHours", () => {
timeZone: "Europe/London",
workingHours: workingHoursB,
dateOverrides: [],
datesOutOfOffice: {},
user: {
isFixed: false,
},
@@ -133,6 +139,7 @@ describe("getAggregateWorkingHours", () => {
timeZone: "Europe/London",
workingHours: workingHoursA,
dateOverrides: [],
datesOutOfOffice: {},
user: {
isFixed: false,
},
@@ -142,12 +149,13 @@ describe("getAggregateWorkingHours", () => {
timeZone: "Europe/London",
workingHours: workingHoursB,
dateOverrides: [],
datesOutOfOffice: {},
user: {
isFixed: true,
},
},
],
"GROUP"
"COLLECTIVE"
);
expect(result).toEqual([
@@ -182,6 +190,7 @@ describe("getAggregateWorkingHours", () => {
timeZone: "Europe/London",
workingHours: workingHoursA,
dateOverrides: [],
datesOutOfOffice: {},
user: {
isFixed: true,
},
@@ -191,12 +200,13 @@ describe("getAggregateWorkingHours", () => {
timeZone: "Europe/London",
workingHours: workingHoursB,
dateOverrides: [],
datesOutOfOffice: {},
user: {
isFixed: true,
},
},
],
"GROUP"
"COLLECTIVE"
);
expect(result).toEqual([...workingHoursB]);
@@ -208,7 +218,7 @@ describe("getAggregateWorkingHours", () => {
days: [1, 2],
startTime: 0,
endTime: 200,
userId: "userA",
userId: 1,
},
];
const workingHoursB: WorkingHours[] = [
@@ -216,7 +226,7 @@ describe("getAggregateWorkingHours", () => {
days: [2, 3],
startTime: 100,
endTime: 300,
userId: "userB",
userId: 2,
},
];
const result = getAggregateWorkingHours(
@@ -226,6 +236,7 @@ describe("getAggregateWorkingHours", () => {
timeZone: "Europe/London",
workingHours: workingHoursA,
dateOverrides: [],
datesOutOfOffice: {},
user: {
isFixed: true,
},
@@ -235,17 +246,18 @@ describe("getAggregateWorkingHours", () => {
timeZone: "Europe/London",
workingHours: workingHoursB,
dateOverrides: [],
datesOutOfOffice: {},
user: {
isFixed: true,
},
},
],
"GROUP"
"MANAGED"
);
expect(result).toEqual([
{
userId: "userA",
userId: 1,
days: [2],
startTime: 100,
endTime: 200,
@@ -285,6 +297,7 @@ describe("getAggregateWorkingHours", () => {
timeZone: "Europe/London",
workingHours: workingHoursA,
dateOverrides: [],
datesOutOfOffice: {},
user: {
isFixed: true,
},
@@ -294,12 +307,13 @@ describe("getAggregateWorkingHours", () => {
timeZone: "Europe/London",
workingHours: workingHoursB,
dateOverrides: [],
datesOutOfOffice: {},
user: {
isFixed: true,
},
},
],
"GROUP"
"COLLECTIVE"
);
expect(result).toEqual([