Skip to content

Commit 1c204a5

Browse files
committed
better test
1 parent c047df4 commit 1c204a5

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

tests/AgentTests/FunctionalAPITests.hs

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2634,17 +2634,30 @@ testSetConnShortLinkAsync :: (ASrvTransport, AStoreType) -> IO ()
26342634
testSetConnShortLinkAsync ps = withAgentClients2 $ \alice bob ->
26352635
withSmpServerStoreLogOn ps testPort $ \_ -> runRight_ $ do
26362636
let userData = UserLinkData "test user data"
2637-
newLinkData = UserInvLinkData userData
2638-
(bobId, (CCLink qInfo _, _)) <- A.createConnection alice NRMInteractive 1 True True SCMInvitation (Just newLinkData) Nothing IKPQOn SMSubscribe
2637+
userCtData = UserContactData {direct = True, owners = [], relays = [], userData}
2638+
newLinkData = UserContactLinkData userCtData
2639+
(contactId, (CCLink qInfo (Just shortLink), _)) <- A.createConnection alice NRMInteractive 1 True True SCMContact (Just newLinkData) Nothing IKPQOn SMSubscribe
2640+
-- verify initial link data
2641+
(_, ContactLinkData _ userCtData') <- getConnShortLink bob 1 shortLink
2642+
liftIO $ userCtData' `shouldBe` userCtData
2643+
-- update link data async
26392644
let updatedData = UserLinkData "updated user data"
2640-
setConnShortLinkAsync alice "1" bobId SCMInvitation (UserInvLinkData updatedData) Nothing
2641-
("1", bobId', LINK (ACSL SCMInvitation _)) <- get alice
2642-
liftIO $ bobId' `shouldBe` bobId
2645+
updatedCtData = UserContactData {direct = False, owners = [], relays = [], userData = updatedData}
2646+
setConnShortLinkAsync alice "1" contactId SCMContact (UserContactLinkData updatedCtData) Nothing
2647+
("1", contactId', LINK (ACSL SCMContact _)) <- get alice
2648+
liftIO $ contactId' `shouldBe` contactId
2649+
-- verify updated link data
2650+
(_, ContactLinkData _ updatedCtData') <- getConnShortLink bob 1 shortLink
2651+
liftIO $ updatedCtData' `shouldBe` updatedCtData
2652+
-- complete connection via contact address
26432653
(aliceId, _) <- joinConnection bob 1 True qInfo "bob's connInfo" SMSubscribe
2644-
("", _, CONF confId _ "bob's connInfo") <- get alice
2645-
allowConnection alice bobId confId "alice's connInfo"
2654+
("", _, REQ invId _ "bob's connInfo") <- get alice
2655+
bobId <- A.prepareConnectionToAccept alice 1 True invId PQSupportOn
2656+
(_, Nothing) <- acceptContact alice 1 bobId True invId "alice's connInfo" PQSupportOn SMSubscribe
2657+
("", _, CONF confId _ "alice's connInfo") <- get bob
2658+
allowConnection bob aliceId confId "bob's connInfo"
2659+
get alice ##> ("", bobId, INFO "bob's connInfo")
26462660
get alice ##> ("", bobId, CON)
2647-
get bob ##> ("", aliceId, INFO "alice's connInfo")
26482661
get bob ##> ("", aliceId, CON)
26492662

26502663
testAsyncCommandsRestore :: (ASrvTransport, AStoreType) -> IO ()

0 commit comments

Comments
 (0)