@@ -18,8 +18,8 @@ import (
18
18
19
19
func TestNewCmdSplitShouldFail (t * testing.T ) {
20
20
w := dto.Workspace {ID : "w" }
21
- start , _ := timehlp .ConvertToTime ("2024-06-02 08:15" )
22
- end , _ := timehlp .ConvertToTime ("2024-06-02 12:15" )
21
+ start , _ := timehlp .ConvertToTime ("08:15" )
22
+ end , _ := timehlp .ConvertToTime ("12:15" )
23
23
te := dto.TimeEntryImpl {
24
24
WorkspaceID : w .ID ,
25
25
ID : "timeentryid" ,
@@ -106,13 +106,13 @@ func TestNewCmdSplitShouldFail(t *testing.T) {
106
106
name : "split must be after the time entry start" ,
107
107
f : findTT ,
108
108
args : []string {te .ID , "7:00" },
109
- err : "time splits must be after 2024-06-02 08:15" ,
109
+ err : "time splits must be after .* 08:15" ,
110
110
},
111
111
{
112
112
name : "split must be before the time entry ends" ,
113
113
f : findTT ,
114
114
args : []string {te .ID , "18:00" },
115
- err : "time splits must be before 2024-06-02 12:15" ,
115
+ err : "time splits must be before .* 12:15" ,
116
116
},
117
117
}
118
118
@@ -145,7 +145,7 @@ func TestNewCmdSplitShouldFail(t *testing.T) {
145
145
146
146
func TestNewCmdSplitShouldCreateNewEntries (t * testing.T ) {
147
147
w := dto.Workspace {ID : "w" }
148
- start , _ := timehlp .ConvertToTime ("2024-06-02 08:00" )
148
+ start , _ := timehlp .ConvertToTime ("08:00" )
149
149
te := dto.TimeEntryImpl {
150
150
WorkspaceID : w .ID ,
151
151
ID : "timeentryid" ,
@@ -229,7 +229,7 @@ func TestNewCmdSplitShouldCreateNewEntries(t *testing.T) {
229
229
name : "split in two" ,
230
230
args : []string {te .ID , "8:30" },
231
231
f : func (t * testing.T ) cmdutil.Factory {
232
- s , _ := timehlp .ConvertToTime ("2024-06-02 08:30" )
232
+ s , _ := timehlp .ConvertToTime ("08:30" )
233
233
f , c := getAndUpdate (t , te , s )
234
234
235
235
create (c , "123" , util.TimeEntryDTO {
@@ -249,10 +249,10 @@ func TestNewCmdSplitShouldCreateNewEntries(t *testing.T) {
249
249
name : "split in three" ,
250
250
args : []string {te .ID , "08:20" , "8:30" },
251
251
f : func (t * testing.T ) cmdutil.Factory {
252
- s , _ := timehlp .ConvertToTime ("2024-06-02 08:20" )
252
+ s , _ := timehlp .ConvertToTime ("08:20" )
253
253
f , c := getAndUpdate (t , te , s )
254
254
255
- e , _ := timehlp .ConvertToTime ("2024-06-02 08:30" )
255
+ e , _ := timehlp .ConvertToTime ("08:30" )
256
256
create (c , "123" , util.TimeEntryDTO {
257
257
Workspace : te .ID ,
258
258
UserID : te .UserID ,
@@ -280,7 +280,7 @@ func TestNewCmdSplitShouldCreateNewEntries(t *testing.T) {
280
280
name : "split in three with end" ,
281
281
args : []string {te .ID , "08:30" , "9:00" },
282
282
f : func (t * testing.T ) cmdutil.Factory {
283
- end , _ := timehlp .ConvertToTime ("2024-06-02 10:00" )
283
+ end , _ := timehlp .ConvertToTime ("10:00" )
284
284
te := dto.TimeEntryImpl {
285
285
WorkspaceID : w .ID ,
286
286
ID : "timeentryid" ,
@@ -293,10 +293,10 @@ func TestNewCmdSplitShouldCreateNewEntries(t *testing.T) {
293
293
),
294
294
}
295
295
296
- s , _ := timehlp .ConvertToTime ("2024-06-02 08:30" )
296
+ s , _ := timehlp .ConvertToTime ("08:30" )
297
297
f , c := getAndUpdate (t , te , s )
298
298
299
- e , _ := timehlp .ConvertToTime ("2024-06-02 09:00" )
299
+ e , _ := timehlp .ConvertToTime ("09:00" )
300
300
create (c , "123" , util.TimeEntryDTO {
301
301
Workspace : te .ID ,
302
302
UserID : te .UserID ,
@@ -342,7 +342,11 @@ func TestNewCmdSplitShouldCreateNewEntries(t *testing.T) {
342
342
cmd .SetArgs (tt .args )
343
343
_ , err := cmd .ExecuteC ()
344
344
345
- if assert .True (t , called ) || assert .NoError (t , err ) {
345
+ if assert .NoError (t , err ) {
346
+ return
347
+ }
348
+
349
+ if assert .True (t , called ) {
346
350
return
347
351
}
348
352
})
0 commit comments