summaryrefslogtreecommitdiff
path: root/Omni/Task.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Omni/Task.hs')
-rw-r--r--Omni/Task.hs16
1 files changed, 10 insertions, 6 deletions
diff --git a/Omni/Task.hs b/Omni/Task.hs
index 11d080b..3a68fa5 100644
--- a/Omni/Task.hs
+++ b/Omni/Task.hs
@@ -286,7 +286,7 @@ move' args
| args `Cli.has` Cli.command "comment" = do
tid <- getArgText args "id"
message <- getArgText args "message"
- updatedTask <- addComment tid message
+ updatedTask <- addComment tid message Human
if isJsonMode args
then outputJson updatedTask
else putStrLn <| "Added comment to task: " <> T.unpack tid
@@ -873,24 +873,28 @@ unitTests =
(parseQueryParam "Done" :: Either Text Status) Test.@?= Right Done,
Test.unit "can add comment to task" <| do
task <- createTask "Task with comment" WorkTask Nothing Nothing P2 Nothing [] "Description"
- updatedTask <- addComment (taskId task) "This is a test comment"
+ updatedTask <- addComment (taskId task) "This is a test comment" Human
length (taskComments updatedTask) Test.@?= 1
case taskComments updatedTask of
- (c : _) -> commentText c Test.@?= "This is a test comment"
+ (c : _) -> do
+ commentText c Test.@?= "This is a test comment"
+ commentAuthor c Test.@?= Human
[] -> Test.assertFailure "Expected at least one comment",
Test.unit "can add multiple comments to task" <| do
task <- createTask "Task with comments" WorkTask Nothing Nothing P2 Nothing [] "Description"
- _ <- addComment (taskId task) "First comment"
- updatedTask <- addComment (taskId task) "Second comment"
+ _ <- addComment (taskId task) "First comment" Junior
+ updatedTask <- addComment (taskId task) "Second comment" Human
length (taskComments updatedTask) Test.@?= 2
case taskComments updatedTask of
(c1 : c2 : _) -> do
commentText c1 Test.@?= "First comment"
+ commentAuthor c1 Test.@?= Junior
commentText c2 Test.@?= "Second comment"
+ commentAuthor c2 Test.@?= Human
_ -> Test.assertFailure "Expected at least two comments",
Test.unit "comments are persisted" <| do
task <- createTask "Persistent comments" WorkTask Nothing Nothing P2 Nothing [] "Description"
- _ <- addComment (taskId task) "Persisted comment"
+ _ <- addComment (taskId task) "Persisted comment" Junior
tasks <- loadTasks
case findTask (taskId task) tasks of
Nothing -> Test.assertFailure "Could not reload task"