This commit is contained in:
@@ -20,11 +20,10 @@ var testWorkDay = models.WorkDay{
|
||||
Bookings: testBookings8hrs,
|
||||
TimeFrom: CatchError(time.Parse("2006-01-02 15:04", "2025-01-01 08:00")),
|
||||
TimeTo: CatchError(time.Parse("2006-01-02 15:04", "2025-01-01 16:30")),
|
||||
Absence: models.Absence{},
|
||||
}
|
||||
|
||||
func TestCalcRealWorkTime(t *testing.T) {
|
||||
workTime := testWorkDay.CalcRealWorkTime(testUser)
|
||||
workTime := testWorkDay.TimeWorkReal(testUser)
|
||||
if workTime != time.Hour*8 {
|
||||
t.Errorf("Calc Worktime Default not working, time should be 8h, but was %s", helper.FormatDuration(workTime))
|
||||
}
|
||||
@@ -64,10 +63,10 @@ func TestCalcWorkPauseDiff(t *testing.T) {
|
||||
for _, test := range testCases {
|
||||
t.Run(test.Name, func(t *testing.T) {
|
||||
testWorkDay.Bookings = test.bookings
|
||||
testWorkDay.CalcRealWorkTime(testUser)
|
||||
testWorkDay.CalcWorkPauseDiff(testUser)
|
||||
testWorkDay.CalcOvertime(testUser)
|
||||
workTime, pauseTime, overTime := testWorkDay.GetAllWorkTimes(testUser)
|
||||
testWorkDay.TimeWorkReal(testUser)
|
||||
testWorkDay.TimePauseReal(testUser)
|
||||
testWorkDay.TimeOvertimeReal(testUser)
|
||||
workTime, pauseTime, overTime := testWorkDay.GetAllWorkTimesReal(testUser)
|
||||
if workTime != test.expectedWorkTime {
|
||||
t.Errorf("Calculated wrong workTime: should be %s, but was %s", helper.FormatDuration(test.expectedWorkTime), helper.FormatDuration(workTime))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user