@@ -984,8 +984,11 @@ describe.each(Object.entries(CRYPTO_BACKENDS))("verification (%s)", (backend: st
984
984
// Add verification request from Bob to Alice in the DM between them
985
985
returnRoomMessageFromSync ( TEST_ROOM_ID , createVerificationRequestEvent ( ) ) ;
986
986
987
- // Wait for the sync response to be processed
988
- await syncPromise ( aliceClient ) ;
987
+ // Wait for the request to be received
988
+ const request1 = await emitPromise ( aliceClient , CryptoEvent . VerificationRequestReceived ) ;
989
+ expect ( request1 . roomId ) . toBe ( TEST_ROOM_ID ) ;
990
+ expect ( request1 . isSelfVerification ) . toBe ( false ) ;
991
+ expect ( request1 . otherUserId ) . toBe ( "@bob:xyz" ) ;
989
992
990
993
const request = aliceClient . getCrypto ( ) ! . findVerificationRequestDMInProgress ( TEST_ROOM_ID , "@bob:xyz" ) ;
991
994
// Expect to find the verification request received during the sync
@@ -1021,14 +1024,19 @@ describe.each(Object.entries(CRYPTO_BACKENDS))("verification (%s)", (backend: st
1021
1024
await awaitDecryption ( matrixEvent ) ;
1022
1025
expect ( matrixEvent . getContent ( ) . msgtype ) . toEqual ( "m.bad.encrypted" ) ;
1023
1026
1027
+ const requestEventPromise = emitPromise ( aliceClient , CryptoEvent . VerificationRequestReceived ) ;
1028
+
1024
1029
// Send Bob the room keys
1025
1030
returnToDeviceMessageFromSync ( toDeviceEvent ) ;
1026
1031
1027
1032
// advance the clock, because the devicelist likes to sleep for 5ms during key downloads
1028
1033
await jest . advanceTimersByTimeAsync ( 10 ) ;
1029
1034
1030
- // Wait for the message to be decrypted
1031
- await awaitDecryption ( matrixEvent , { waitOnDecryptionFailure : true } ) ;
1035
+ // Wait for the request to be decrypted
1036
+ const request1 = await requestEventPromise ;
1037
+ expect ( request1 . roomId ) . toBe ( TEST_ROOM_ID ) ;
1038
+ expect ( request1 . isSelfVerification ) . toBe ( false ) ;
1039
+ expect ( request1 . otherUserId ) . toBe ( "@bob:xyz" ) ;
1032
1040
1033
1041
const request = aliceClient . getCrypto ( ) ! . findVerificationRequestDMInProgress ( TEST_ROOM_ID , "@bob:xyz" ) ;
1034
1042
// Expect to find the verification request received during the sync
0 commit comments