@@ -99,16 +99,6 @@ const TEST_HOMESERVER_URL = "https://alice-server.com";
99
99
*/
100
100
// we test with both crypto stacks...
101
101
describe . each ( Object . entries ( CRYPTO_BACKENDS ) ) ( "verification (%s)" , ( backend : string , initCrypto : InitCrypto ) => {
102
- // and with (1) the default verification method list, (2) a custom verification method list.
103
- describe . each ( [ undefined , [ "m.sas.v1" , "m.qr_code.show.v1" , "m.reciprocate.v1" ] ] ) (
104
- "supported methods=%s" ,
105
- ( methods ) => {
106
- runTests ( backend , initCrypto , methods ) ;
107
- } ,
108
- ) ;
109
- } ) ;
110
-
111
- function runTests ( backend : string , initCrypto : InitCrypto , methods : string [ ] | undefined ) {
112
102
// oldBackendOnly is an alternative to `it` or `test` which will skip the test if we are running against the
113
103
// Rust backend. Once we have full support in the rust sdk, it will go away.
114
104
const oldBackendOnly = backend === "rust-sdk" ? test . skip : test ;
@@ -155,7 +145,9 @@ function runTests(backend: string, initCrypto: InitCrypto, methods: string[] | u
155
145
e2eKeyResponder . addDeviceKeys ( TEST_USER_ID , TEST_DEVICE_ID , SIGNED_TEST_DEVICE_DATA ) ;
156
146
} ) ;
157
147
158
- it ( "can verify another device via SAS" , async ( ) => {
148
+ // test with (1) the default verification method list, (2) a custom verification method list.
149
+ const TEST_METHODS = [ "m.sas.v1" , "m.qr_code.show.v1" , "m.reciprocate.v1" ] ;
150
+ it . each ( [ undefined , TEST_METHODS ] ) ( "can verify via SAS (supported methods=%s)" , async ( methods ) => {
159
151
aliceClient = await startTestClient ( { verificationMethods : methods } ) ;
160
152
await waitForDeviceList ( ) ;
161
153
@@ -321,7 +313,7 @@ function runTests(backend: string, initCrypto: InitCrypto, methods: string[] | u
321
313
} ) ;
322
314
323
315
it ( "Can make a verification request to *all* devices" , async ( ) => {
324
- aliceClient = await startTestClient ( { verificationMethods : methods } ) ;
316
+ aliceClient = await startTestClient ( ) ;
325
317
// we need an existing cross-signing key for this
326
318
e2eKeyResponder . addCrossSigningData ( SIGNED_CROSS_SIGNING_KEYS_DATA ) ;
327
319
await waitForDeviceList ( ) ;
@@ -351,7 +343,7 @@ function runTests(backend: string, initCrypto: InitCrypto, methods: string[] | u
351
343
} ) ;
352
344
353
345
oldBackendOnly ( "can verify another via QR code with an untrusted cross-signing key" , async ( ) => {
354
- aliceClient = await startTestClient ( { verificationMethods : methods } ) ;
346
+ aliceClient = await startTestClient ( ) ;
355
347
// QRCode fails if we don't yet have the cross-signing keys, so make sure we have them now.
356
348
e2eKeyResponder . addCrossSigningData ( SIGNED_CROSS_SIGNING_KEYS_DATA ) ;
357
349
await waitForDeviceList ( ) ;
@@ -367,9 +359,7 @@ function runTests(backend: string, initCrypto: InitCrypto, methods: string[] | u
367
359
const toDeviceMessage = requestBody . messages [ TEST_USER_ID ] [ TEST_DEVICE_ID ] ;
368
360
expect ( toDeviceMessage . methods ) . toContain ( "m.qr_code.show.v1" ) ;
369
361
expect ( toDeviceMessage . methods ) . toContain ( "m.reciprocate.v1" ) ;
370
- if ( methods === undefined ) {
371
- expect ( toDeviceMessage . methods ) . toContain ( "m.qr_code.scan.v1" ) ;
372
- }
362
+ expect ( toDeviceMessage . methods ) . toContain ( "m.qr_code.scan.v1" ) ;
373
363
expect ( toDeviceMessage . from_device ) . toEqual ( aliceClient . deviceId ) ;
374
364
expect ( toDeviceMessage . transaction_id ) . toEqual ( transactionId ) ;
375
365
@@ -443,7 +433,7 @@ function runTests(backend: string, initCrypto: InitCrypto, methods: string[] | u
443
433
} ) ;
444
434
445
435
it ( "can cancel during the SAS phase" , async ( ) => {
446
- aliceClient = await startTestClient ( { verificationMethods : methods } ) ;
436
+ aliceClient = await startTestClient ( ) ;
447
437
await waitForDeviceList ( ) ;
448
438
449
439
// have alice initiate a verification. She should send a m.key.verification.request
@@ -511,7 +501,7 @@ function runTests(backend: string, initCrypto: InitCrypto, methods: string[] | u
511
501
} ) ;
512
502
513
503
oldBackendOnly ( "Incoming verification: can accept" , async ( ) => {
514
- aliceClient = await startTestClient ( { verificationMethods : methods } ) ;
504
+ aliceClient = await startTestClient ( ) ;
515
505
const TRANSACTION_ID = "abcd" ;
516
506
517
507
// Initiate the request by sending a to-device message
@@ -579,7 +569,7 @@ function runTests(backend: string, initCrypto: InitCrypto, methods: string[] | u
579
569
ev . sender ??= TEST_USER_ID ;
580
570
syncResponder . sendOrQueueSyncResponse ( { to_device : { events : [ ev ] } } ) ;
581
571
}
582
- }
572
+ } ) ;
583
573
584
574
/**
585
575
* Wait for the client under test to send a to-device message of the given type.
0 commit comments