@@ -440,7 +440,7 @@ spec = do
440440 withMemoryDb conf $ \ memConn -> do
441441 insertRecord " tasks" memConn exampleTask
442442 result <-
443- doTasks confWithPostModify memConn Nothing [exampleTask. ulid]
443+ doTasks confWithPostModify memConn Nothing Nothing [exampleTask. ulid]
444444 unpack (show result) `shouldContain` " post-modify ran"
445445
446446 it " fires post-modify hook on `tag`" $ do
@@ -498,7 +498,7 @@ spec = do
498498 it " completes it" $ do
499499 withMemoryDb conf $ \ memConn -> do
500500 insertRecord " tasks" memConn exampleTask
501- doResult <- doTasks conf memConn Nothing [exampleTask. ulid]
501+ doResult <- doTasks conf memConn Nothing Nothing [exampleTask. ulid]
502502 unpack (show doResult) `shouldStartWith` " ✅ Finished task"
503503 tasks :: [Task ] <- query_ memConn " SELECT * FROM tasks"
504504 case tasks of
@@ -507,12 +507,29 @@ spec = do
507507 updatedTask `shouldSatisfy` (\ task -> isJust task. closed_utc)
508508 _ -> P. die " Found more than one task"
509509
510+ it " completes it with an explicit closed UTC via --utc" $ do
511+ withMemoryDb conf $ \ memConn -> do
512+ insertRecord " tasks" memConn exampleTask
513+ let utcTxt = " 2020-01-15 08:30:00"
514+ case parseUtc utcTxt of
515+ Nothing -> P. die " Invalid UTC string"
516+ Just utcStamp -> do
517+ doResult <-
518+ doTasks conf memConn (Just utcStamp) Nothing [exampleTask. ulid]
519+ unpack (show doResult) `shouldStartWith` " ✅ Finished task"
520+ tasks :: [Task ] <- query_ memConn " SELECT * FROM tasks"
521+ case tasks of
522+ [updatedTask] -> do
523+ updatedTask. state `shouldBe` Just Done
524+ updatedTask. closed_utc `shouldBe` Just " 2020-01-15 08:30:00"
525+ _ -> P. die " Found more than one task"
526+
510527 it " refuses to complete a task with open blockers" $ do
511528 withMemoryDb conf $ \ memConn -> do
512529 insertRecord " tasks" memConn task1
513530 insertRecord " tasks" memConn task2
514531 _ <- blockTasks conf memConn task1. ulid task2. ulid
515- result <- doTasks conf memConn Nothing [task2. ulid]
532+ result <- doTasks conf memConn Nothing Nothing [task2. ulid]
516533 unpack (show result) `shouldContain` " is blocked by"
517534 -- The blocked task must remain open.
518535 tasks :: [Task ] <-
@@ -524,7 +541,7 @@ spec = do
524541 insertRecord " tasks" memConn task1
525542 insertRecord " tasks" memConn task2
526543 _ <- blockTasks conf memConn task1. ulid task2. ulid
527- result <- endTasks conf memConn Nothing [task2. ulid]
544+ result <- endTasks conf memConn Nothing Nothing [task2. ulid]
528545 unpack (show result) `shouldContain` " is blocked by"
529546
530547 it " refuses to trash a task with open blockers" $ do
@@ -541,10 +558,10 @@ spec = do
541558 insertRecord " tasks" memConn task2
542559 _ <- blockTasks conf memConn task1. ulid task2. ulid
543560 -- Close the blocker first.
544- blockerResult <- doTasks conf memConn Nothing [task1. ulid]
561+ blockerResult <- doTasks conf memConn Nothing Nothing [task1. ulid]
545562 unpack (show blockerResult) `shouldStartWith` " ✅ Finished task"
546563 -- Now the originally-blocked task can be closed.
547- targetResult <- doTasks conf memConn Nothing [task2. ulid]
564+ targetResult <- doTasks conf memConn Nothing Nothing [task2. ulid]
548565 unpack (show targetResult) `shouldStartWith` " ✅ Finished task"
549566
550567 it " deletes it" $ do
0 commit comments