From f395f350d5ee611b13ac4d89e3aef8616d368f6d Mon Sep 17 00:00:00 2001 From: Ashley Stacey Date: Wed, 14 Aug 2019 13:56:49 +1000 Subject: [PATCH] [#500] Trails-tests: Update test descriptions. --- .../trails/test/Mirza/Trails/Tests/Client.hs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/projects/trails/test/Mirza/Trails/Tests/Client.hs b/projects/trails/test/Mirza/Trails/Tests/Client.hs index 275425d5..8428de60 100644 --- a/projects/trails/test/Mirza/Trails/Tests/Client.hs +++ b/projects/trails/test/Mirza/Trails/Tests/Client.hs @@ -43,7 +43,7 @@ import Data.UUID.V4 -- === Trails Servant Client tests clientSpec :: IO TestTree clientSpec = do - let trailTests = testCaseSteps "TODO" $ \step -> + let trailTests = testCaseSteps "Trails Endpoints" $ \step -> bracket runTrailsApp (\(a,b) -> endWaiApp (a,b)) $ \(_tid, baseurl) -> do let http = runClient baseurl @@ -51,13 +51,13 @@ clientSpec = do -- machinery and time constraints of the project we just implement a bunch of copy pasted simple tests to -- check a variety of classic test boundry scenarios. - step "That when there are no entries in the database that getting by signature responds corretly." + step "That when there are no entries in the database that getting by signature responds corretly" getGetSignatureInitialEmpty <- http $ getTrailBySignature (SignaturePlaceholder "invalid") getGetSignatureInitialEmpty `shouldSatisfy` isLeft getGetSignatureInitialEmpty `shouldSatisfy` (checkFailureStatus NS.notFound404) getGetSignatureInitialEmpty `shouldSatisfy` (checkFailureMessage "A trail with a matching signature was not found.") - step "That when there are no entries in the database that getting by eventId responds corretly." + step "That when there are no entries in the database that getting by eventId responds corretly" empty_non_matching_uuid <- liftIO nextRandom getGetEventIdInitialEmpty <- http $ getTrailByEventId (EventId empty_non_matching_uuid) getGetEventIdInitialEmpty `shouldSatisfy` isLeft @@ -66,16 +66,16 @@ clientSpec = do -- Trail: * - step "That adding the first entry in a trail works." + step "That adding the first entry in a trail works" singleEntry <- buildEntry addFirstEntryResult <- http $ addTrail [singleEntry] addFirstEntryResult `shouldBe` Right NoContent - step "That getting a single entry trail by signature works." + step "That getting a single entry trail by signature works" getSingleEntryBySignatureResult <- http $ getTrailBySignature (trailEntrySignature singleEntry) getSingleEntryBySignatureResult `shouldMatchTrail` [singleEntry] - step "That getting a single entry trail by eventId works." + step "That getting a single entry trail by eventId works" getSingleEntryByEventIdResult <- http $ getTrailByEventId (trailEntryEventId singleEntry) getSingleEntryByEventIdResult `shouldMatchTrail` [singleEntry] @@ -457,16 +457,16 @@ checkTrail step http differentator trail = checkPartialTrail step http different checkPartialTrail :: (String -> IO()) -> (forall a. ClientM a -> IO (Either ServantError a)) -> String -> [TrailEntry] -> [TrailEntry] -> [SignaturePlaceholder] -> [EventId] -> IO () checkPartialTrail step http differentator inputTrail expectedTrail sigs eventIds = do - step $ "That adding " <> differentator <> " trail works." + step $ "That adding " <> differentator <> " trail works" addEntryResult <- http $ addTrail inputTrail addEntryResult `shouldBe` Right NoContent - step $ "That getting a " <> differentator <> " trail by (each of the) signature(s) works." + step $ "That getting a " <> differentator <> " trail by (each of the) signature(s) works" getEntryBySignatureResult <- traverse (\sig -> http $ getTrailBySignature sig) sigs signatureResults <- traverse (`shouldMatchTrail` expectedTrail) getEntryBySignatureResult pure $ forceElements signatureResults - step $ "That getting a " <> differentator <> " trail by (each of the) eventId(s) works." + step $ "That getting a " <> differentator <> " trail by (each of the) eventId(s) works" getEntryByEventIdResult <- traverse (\eventId -> http $ getTrailByEventId eventId) eventIds eventIdResults <- traverse (`shouldMatchTrail` expectedTrail) getEntryByEventIdResult pure $ forceElements eventIdResults