Skip to content

Commit 7f51bc6

Browse files
Improve integration tests
1 parent c997f95 commit 7f51bc6

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,6 @@ $ export $(nix develop -c conduit-setup)
4949
$ cabal test all
5050
```
5151

52+
Restart the commands to run the test on a fresh environment.
53+
5254
If you experience any difficulties, please don't hesistate to raise an issue.

flake.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
# A script to start a local matrix server with conduit
5757
conduitStart = pkgs.writeScriptBin "conduit-start" ''
5858
#!/bin/sh -e
59+
rm -Rf ${conduitHome}
5960
mkdir -p ${conduitHome}
6061
exec env CONDUIT_CONFIG=${conduitConfig} ${pkgs.matrix-conduit}/bin/conduit
6162
'';

matrix-client/test/Spec.hs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ main = do
2626
_ -> do
2727
putStrLn "Skipping integration test"
2828
pure $ pure mempty
29-
hspec (parallel $ spec >> runIntegration)
29+
hspec (parallel spec >> runIntegration)
3030

3131
integration :: ClientSession -> ClientSession -> Spec
3232
integration sess1 sess2 = do
@@ -44,20 +44,20 @@ integration sess1 sess2 = do
4444
)
4545
case resp of
4646
Left err -> meError err `shouldBe` "Alias already exists"
47-
Right (RoomID roomID) -> roomID `shouldSatisfy` (/= mempty)
47+
Right (RoomID room) -> room `shouldSatisfy` (/= mempty)
4848
it "join room" $ do
4949
resp <- joinRoom sess1 "#test:localhost"
5050
case resp of
5151
Left err -> error (show err)
52-
Right (RoomID roomID) -> roomID `shouldSatisfy` (/= mempty)
52+
Right (RoomID room) -> room `shouldSatisfy` (/= mempty)
5353
resp' <- joinRoom sess2 "#test:localhost"
5454
case resp' of
5555
Left err -> error (show err)
56-
Right (RoomID roomID) -> roomID `shouldSatisfy` (/= mempty)
56+
Right (RoomID room) -> room `shouldSatisfy` (/= mempty)
5757
it "send message and reply" $ do
5858
-- Flush previous events
5959
Right sr <- sync sess2 Nothing Nothing Nothing Nothing
60-
Right [room] <- getJoinedRooms sess1
60+
Right (room:_) <- getJoinedRooms sess1
6161
let msg body = RoomMessageText $ MessageText body TextType Nothing Nothing
6262
let since = srNextBatch sr
6363
Right eventID <- sendMessage sess1 room (EventRoomMessage $ msg "Hello") (TxnID since)
@@ -112,10 +112,10 @@ spec = describe "unit tests" $ do
112112
rateLimitSelector :: MatrixException -> Bool
113113
rateLimitSelector MatrixRateLimit = True
114114
checkPause op action = do
115-
MkSystemTime start _ <- getSystemTime
115+
MkSystemTime startTS _ <- getSystemTime
116116
void action
117-
MkSystemTime end _ <- getSystemTime
118-
(end - start) `shouldSatisfy` (`op` 1)
117+
MkSystemTime endTS _ <- getSystemTime
118+
(endTS - startTS) `shouldSatisfy` (`op` 1)
119119
encodePretty =
120120
Aeson.encodePretty'
121121
( Aeson.defConfig {Aeson.confIndent = Aeson.Spaces 0, Aeson.confCompare = compare @Text}

0 commit comments

Comments
 (0)