Skip to content

Commit

Permalink
[#500] Trails-tests: Add test case to verify that trail entry order d…
Browse files Browse the repository at this point in the history
…oesn't matter.
  • Loading branch information
a-stacey committed Sep 4, 2019
1 parent c0529fe commit c402d09
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions projects/trails/test/Mirza/Trails/Tests/Client.hs
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,21 @@ clientSpec = do
noPreviousAddGetResult <- http $ getTrailByEventId (trailEntryEventId noPreviousEntry)
noPreviousAddGetResult `shouldSatisfy` isLeft

step "Test that the order of entries in a trail with parent entries in the trail submitted doesn't matter"
-- Explicitly we want to test that the trail doesn't have to be structured so that the previous entries appear explicitly before/after they are referenced from other entries.
trailOrder1 <- buildTwoEntryTrail
trailOrder2 <- swapIO $ buildTwoEntryTrail
verifyValidTrailTestIntegrityCheck trailOrder1
verifyValidTrailTestIntegrityCheck trailOrder2
trailOrder1Result <- http $ addTrail trailOrder1
trailOrder1Result `shouldBe` Right NoContent
trailOrder2Result <- http $ addTrail trailOrder2
trailOrder2Result `shouldBe` Right NoContent
trailOrder1GetBySignatureResult <- http $ getTrailBySignature $ firstSignature trailOrder1
trailOrder1GetBySignatureResult `shouldMatchTrail` trailOrder1
trailOrder2GetBySignatureResult <- http $ getTrailBySignature $ firstSignature trailOrder2
trailOrder2GetBySignatureResult `shouldMatchTrail` trailOrder2

-- TODO: Test that invalid signature fails.


Expand Down

0 comments on commit c402d09

Please sign in to comment.