@@ -1896,22 +1896,6 @@ describe("RustCrypto", () => {
18961896 } ) ;
18971897
18981898 it ( "reset should reset 4S, backup and cross-signing" , async ( ) => {
1899- // We don't have a key backup
1900- fetchMock . get ( "path:/_matrix/client/v3/room_keys/version" , { } ) ;
1901-
1902- const rustCrypto = await makeTestRustCrypto ( makeMatrixHttpApi ( ) , undefined , undefined , secretStorage ) ;
1903-
1904- const authUploadDeviceSigningKeys = jest . fn ( ) ;
1905- await rustCrypto . resetEncryption ( authUploadDeviceSigningKeys ) ;
1906-
1907- // The default key id should be deleted
1908- expect ( secretStorage . setDefaultKeyId ) . toHaveBeenCalledWith ( null ) ;
1909- expect ( await rustCrypto . getActiveSessionBackupVersion ( ) ) . toBeNull ( ) ;
1910- // The new cross signing keys should be uploaded
1911- expect ( authUploadDeviceSigningKeys ) . toHaveBeenCalledWith ( expect . any ( Function ) ) ;
1912- } ) ;
1913-
1914- it ( "key backup should be re-enabled after reset" , async ( ) => {
19151899 // When we will delete the key backup
19161900 let backupIsDeleted = false ;
19171901 fetchMock . delete ( "path:/_matrix/client/v3/room_keys/version/1" , ( ) => {
@@ -1923,6 +1907,13 @@ describe("RustCrypto", () => {
19231907 return backupIsDeleted ? { } : testData . SIGNED_BACKUP_DATA ;
19241908 } ) ;
19251909
1910+ // A new key backup should be created after the reset
1911+ let newKeyBackupInfo ! : KeyBackupInfo ;
1912+ fetchMock . post ( "path:/_matrix/client/v3/room_keys/version" , ( res , options ) => {
1913+ newKeyBackupInfo = JSON . parse ( options . body as string ) ;
1914+ return { version : "2" } ;
1915+ } ) ;
1916+
19261917 // We consider the key backup as trusted
19271918 jest . spyOn ( RustBackupManager . prototype , "isKeyBackupTrusted" ) . mockResolvedValue ( {
19281919 trusted : true ,
@@ -1933,13 +1924,6 @@ describe("RustCrypto", () => {
19331924 // We have a key backup
19341925 expect ( await rustCrypto . getActiveSessionBackupVersion ( ) ) . not . toBeNull ( ) ;
19351926
1936- // A new key backup should be created after the reset
1937- let newKeyBackupInfo ! : KeyBackupInfo ;
1938- fetchMock . post ( "path:/_matrix/client/v3/room_keys/version" , ( res , options ) => {
1939- newKeyBackupInfo = JSON . parse ( options . body as string ) ;
1940- return { version : "2" } ;
1941- } ) ;
1942-
19431927 const authUploadDeviceSigningKeys = jest . fn ( ) ;
19441928 await rustCrypto . resetEncryption ( authUploadDeviceSigningKeys ) ;
19451929
0 commit comments