fixed: pause time calculation from work instead of presence time
All checks were successful
Tests / Run Go Tests (push) Successful in 1m44s
All checks were successful
Tests / Run Go Tests (push) Successful in 1m44s
This commit is contained in:
@@ -30,18 +30,63 @@ func TestWorkdayWorktimeDay(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
testName: "Bookings6hrs",
|
||||
bookings: testBookings6hrs,
|
||||
expectedTime: time.Hour * 6,
|
||||
bookings: testBookings6hrs, //work 6h
|
||||
expectedTime: time.Hour * 6, //pause 0
|
||||
},
|
||||
{
|
||||
testName: "Bookings8hrs",
|
||||
bookings: testBookings8hrs,
|
||||
expectedTime: time.Hour*7 + time.Minute*30,
|
||||
bookings: testBookings8hrs, //work 8 pause 0
|
||||
expectedTime: time.Hour*7 + time.Minute*30, //pause 30 --> corrected
|
||||
},
|
||||
{
|
||||
testName: "Bookings10hrs",
|
||||
bookings: testBookings10hrs,
|
||||
expectedTime: time.Hour*9 + time.Minute*15,
|
||||
bookings: testBookings10hrs, //work 10 pause 0
|
||||
expectedTime: time.Hour*9 + time.Minute*15, //pause 45 --> corrected
|
||||
},
|
||||
{
|
||||
testName: "Booking 6h with 30 min Break",
|
||||
bookings: testBookings6hrsBreak30min, //work 6 pause 30
|
||||
expectedTime: time.Hour * 6, //pause 30 --> bc real pause
|
||||
},
|
||||
{
|
||||
testName: "Booking 6h 10min with 30 min Break",
|
||||
bookings: testBookings610hrsBreak30min, //work 6 10 pause 30
|
||||
expectedTime: time.Hour*6 + time.Minute*10, //pause 30 --> real pause
|
||||
},
|
||||
{
|
||||
testName: "Booking 9h with 30 min Break",
|
||||
bookings: testBookings9hrsBreak30min, //work 9 pause 30
|
||||
expectedTime: time.Hour * 9, //pause 30 --> real pause
|
||||
},
|
||||
{
|
||||
testName: "Booking 9h 30min",
|
||||
bookings: testBookings930hrs, //work 9 30 pause 0
|
||||
expectedTime: time.Hour * 9, //pause 30 --> corrected
|
||||
},
|
||||
{
|
||||
testName: "Booking 9h 40min with 30min Break",
|
||||
bookings: testBookings910hrsBreak30min, //work 9 10 pause 30
|
||||
expectedTime: time.Hour*8 + time.Minute*55, //pause 45 --> real + corrected
|
||||
},
|
||||
{
|
||||
testName: "Booking 9h 40min with 35min Break",
|
||||
bookings: testBookings910hrsBreak35min, //work 9 10 pause 35
|
||||
expectedTime: time.Hour * 9, //pause 45 --> real + corrected
|
||||
},
|
||||
{
|
||||
testName: "Booking 9h 45min",
|
||||
bookings: testBookings945hrs, //work 9 45 pause 0
|
||||
expectedTime: time.Hour * 9, //pause 45 --> corrected
|
||||
},
|
||||
{
|
||||
testName: "Booking 10h Break 45min",
|
||||
bookings: testBookings10hrsBreak45min, //work 9 15 pause 45
|
||||
expectedTime: time.Hour*9 + time.Minute*15, //pause 45 --> real
|
||||
},
|
||||
{
|
||||
testName: "Booking 10h 30min Break 45min",
|
||||
bookings: testBookings1030hrsBreak45min, //work 9 45 pause 45
|
||||
expectedTime: time.Hour*9 + time.Minute*45, //pause 45 --> real
|
||||
},
|
||||
}
|
||||
|
||||
@@ -113,6 +158,51 @@ func TestWorkdayPausetimeDay(t *testing.T) {
|
||||
bookings: testBookings10hrs,
|
||||
expectedTime: time.Minute * 45,
|
||||
},
|
||||
{
|
||||
testName: "Booking 6h with 30 min Break",
|
||||
bookings: testBookings6hrsBreak30min, //work 6 pause 30
|
||||
expectedTime: time.Minute * 30, //pause 30 --> bc real pause
|
||||
},
|
||||
{
|
||||
testName: "Booking 6h 10min with 30 min Break",
|
||||
bookings: testBookings610hrsBreak30min, //work 6 10 pause 30
|
||||
expectedTime: time.Minute * 30, //pause 30 --> real pause
|
||||
},
|
||||
{
|
||||
testName: "Booking 9h with 30 min Break",
|
||||
bookings: testBookings9hrsBreak30min, //work 9 pause 30
|
||||
expectedTime: time.Minute * 30, //pause 30 --> real pause
|
||||
},
|
||||
{
|
||||
testName: "Booking 9h 30min",
|
||||
bookings: testBookings930hrs, //work 9 30 pause 0
|
||||
expectedTime: time.Minute * 30, //pause 30 --> corrected
|
||||
},
|
||||
{
|
||||
testName: "Booking 9h 40min with 30min Break",
|
||||
bookings: testBookings910hrsBreak30min, //work 9 10 pause 30
|
||||
expectedTime: time.Minute * 45, //pause 45 --> real + corrected
|
||||
},
|
||||
{
|
||||
testName: "Booking 9h 40min with 35min Break",
|
||||
bookings: testBookings910hrsBreak35min, //work 9 10 pause 35
|
||||
expectedTime: time.Minute * 45, //pause 45 --> real + corrected
|
||||
},
|
||||
{
|
||||
testName: "Booking 9h 45min",
|
||||
bookings: testBookings945hrs, //work 9 45 pause 0
|
||||
expectedTime: time.Minute * 45, //pause 45 --> corrected
|
||||
},
|
||||
{
|
||||
testName: "Booking 10h Break 45min",
|
||||
bookings: testBookings10hrsBreak45min, //work 9 15 pause 45
|
||||
expectedTime: time.Minute * 45, //pause 45 --> real
|
||||
},
|
||||
{
|
||||
testName: "Booking 10h 30min Break 45min",
|
||||
bookings: testBookings1030hrsBreak45min, //work 9 45 pause 45
|
||||
expectedTime: time.Minute * 45, //pause 45 --> real
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
|
||||
Reference in New Issue
Block a user