diff --git a/ts/test-mock/messaging/relink_test.node.ts b/ts/test-mock/messaging/relink_test.node.ts index d4643e1404..2dbc33905a 100644 --- a/ts/test-mock/messaging/relink_test.node.ts +++ b/ts/test-mock/messaging/relink_test.node.ts @@ -132,7 +132,7 @@ describe('messaging/relink', function (this: Mocha.Suite) { state = state.unpin(second); state = state.pin(first); - await phone.setStorageState(state); + state = await phone.setStorageState(state); await phone.sendFetchStorage({ timestamp: bootstrap.getTimestamp(), }); diff --git a/ts/test-mock/pnp/merge_test.node.ts b/ts/test-mock/pnp/merge_test.node.ts index 305c1b8183..4b7151f200 100644 --- a/ts/test-mock/pnp/merge_test.node.ts +++ b/ts/test-mock/pnp/merge_test.node.ts @@ -183,7 +183,7 @@ describe('pnp/merge', function (this: Mocha.Suite) { ); { const state = await phone.expectStorageState('consistency check'); - await phone.setStorageState( + const newState = await phone.setStorageState( state.mergeContact(pniContact, { identityState: Proto.ContactRecord.IdentityState.DEFAULT, whitelisted: true, @@ -195,7 +195,7 @@ describe('pnp/merge', function (this: Mocha.Suite) { await phone.sendFetchStorage({ timestamp: bootstrap.getTimestamp(), }); - await app.waitForManifestVersion(state.version); + await app.waitForManifestVersion(newState.version); } debug('Verify final state'); @@ -359,7 +359,7 @@ describe('pnp/merge', function (this: Mocha.Suite) { identityKey: pniContact.publicKey.serialize(), profileKey: pniContact.profileKey.serialize(), }); - await phone.setStorageState(state); + state = await phone.setStorageState(state); await phone.sendFetchStorage({ timestamp: bootstrap.getTimestamp(), }); @@ -496,7 +496,7 @@ describe('pnp/merge', function (this: Mocha.Suite) { ); state = state.pin(aciContact, ServiceIdKind.ACI); - await phone.setStorageState(state); + state = await phone.setStorageState(state); await phone.sendFetchStorage({ timestamp: bootstrap.getTimestamp(), }); @@ -614,7 +614,7 @@ describe('pnp/merge', function (this: Mocha.Suite) { ); { const state = await phone.expectStorageState('consistency check'); - await phone.setStorageState( + const newState = await phone.setStorageState( state.mergeContact(pniContact, { identityState: Proto.ContactRecord.IdentityState.DEFAULT, whitelisted: true, @@ -626,7 +626,7 @@ describe('pnp/merge', function (this: Mocha.Suite) { await phone.sendFetchStorage({ timestamp: bootstrap.getTimestamp(), }); - await app.waitForManifestVersion(state.version); + await app.waitForManifestVersion(newState.version); } const window = await app.getWindow(); diff --git a/ts/test-mock/storage/archive_test.node.ts b/ts/test-mock/storage/archive_test.node.ts index 4bf0f754a9..fa2a050625 100644 --- a/ts/test-mock/storage/archive_test.node.ts +++ b/ts/test-mock/storage/archive_test.node.ts @@ -40,11 +40,11 @@ describe('storage service', function (this: Mocha.Suite) { debug('archiving contact'); { const state = await phone.expectStorageState('consistency check'); - const newState = state + const modifiedState = state .updateContact(firstContact, { archived: true }) .unpin(firstContact); - await phone.setStorageState(newState); + const newState = await phone.setStorageState(modifiedState); await phone.sendFetchStorage({ timestamp: bootstrap.getTimestamp(), }); @@ -63,13 +63,13 @@ describe('storage service', function (this: Mocha.Suite) { debug('unarchiving pinned contact'); { const state = await phone.expectStorageState('consistency check'); - const newState = state + const modifiedState = state .updateContact(firstContact, { archived: false, }) .pin(firstContact); - await phone.setStorageState(newState); + const newState = await phone.setStorageState(modifiedState); await phone.sendFetchStorage({ timestamp: bootstrap.getTimestamp(), }); @@ -100,6 +100,7 @@ describe('storage service', function (this: Mocha.Suite) { const archiveButton = window.getByRole('menuitem', { name: 'Archive', + exact: true, }); await archiveButton.click(); diff --git a/ts/test-mock/storage/chat_folder_test.node.ts b/ts/test-mock/storage/chat_folder_test.node.ts index bd1399e1ff..4d0738949f 100644 --- a/ts/test-mock/storage/chat_folder_test.node.ts +++ b/ts/test-mock/storage/chat_folder_test.node.ts @@ -159,7 +159,7 @@ describe('storage service/chat folders', function (this: Mocha.Suite) { }, }); - await phone.setStorageState(state); + state = await phone.setStorageState(state); await phone.sendFetchStorage({ timestamp: bootstrap.getTimestamp() }); await app.waitForManifestVersion(state.version); @@ -184,7 +184,7 @@ describe('storage service/chat folders', function (this: Mocha.Suite) { } ); - await phone.setStorageState(state); + state = await phone.setStorageState(state); await phone.sendFetchStorage({ timestamp: bootstrap.getTimestamp() }); await app.waitForManifestVersion(state.version); @@ -211,7 +211,7 @@ describe('storage service/chat folders', function (this: Mocha.Suite) { } ); - await phone.setStorageState(state); + state = await phone.setStorageState(state); await phone.sendFetchStorage({ timestamp: bootstrap.getTimestamp() }); await app.waitForManifestVersion(state.version); diff --git a/ts/test-mock/storage/conflict_test.node.ts b/ts/test-mock/storage/conflict_test.node.ts index f9d07b09b9..432d929395 100644 --- a/ts/test-mock/storage/conflict_test.node.ts +++ b/ts/test-mock/storage/conflict_test.node.ts @@ -65,7 +65,9 @@ describe('storage service', function (this: Mocha.Suite) { .getByRole('button', { name: 'More Info' }) .click(); - await window.getByRole('menuitem', { name: 'Archive' }).click(); + await window + .getByRole('menuitem', { name: 'Archive', exact: true }) + .click(); await phone.waitForStorageState({ after: state, @@ -150,7 +152,9 @@ describe('storage service', function (this: Mocha.Suite) { .getByRole('button', { name: 'More Info' }) .click(); - await window.getByRole('menuitem', { name: 'Pin chat' }).click(); + await window + .getByRole('menuitem', { name: 'Pin chat', exact: true }) + .click(); const newState = await phone.waitForStorageState({ after: state, diff --git a/ts/test-mock/storage/notification_profiles_test.node.ts b/ts/test-mock/storage/notification_profiles_test.node.ts index d9fe03f8e0..b486d239a2 100644 --- a/ts/test-mock/storage/notification_profiles_test.node.ts +++ b/ts/test-mock/storage/notification_profiles_test.node.ts @@ -264,6 +264,7 @@ describe('storage service/notification profiles', function (this: Mocha.Suite) { deletedAtTimestampMs: null, }; + let uploadedState: StorageState; { let newState = firstState.addRecord({ type: IdentifierType.NOTIFICATION_PROFILE, @@ -303,14 +304,14 @@ describe('storage service/notification profiles', function (this: Mocha.Suite) { }, }); - await phone.setStorageState(newState); + uploadedState = await phone.setStorageState(newState); } debug('Waiting for desktop to process storage service updates'); await phone.sendFetchStorage({ timestamp: bootstrap.getTimestamp(), }); - await app.waitForManifestVersion(firstState.version + 1n); + await app.waitForManifestVersion(uploadedState.version); debug('Now we should be on the Notification Profiles list page'); await expect( @@ -484,7 +485,7 @@ describe('storage service/notification profiles', function (this: Mocha.Suite) { notificationProfileSyncDisabled: false, }); - await phone.setStorageState(newState); + uploadedState = await phone.setStorageState(newState); } // now desktop will see the off->on flip for sync, and reconcile profiles: @@ -496,7 +497,7 @@ describe('storage service/notification profiles', function (this: Mocha.Suite) { await phone.sendFetchStorage({ timestamp: bootstrap.getTimestamp(), }); - await app.waitForManifestVersion(secondState.version + 1n); + await app.waitForManifestVersion(uploadedState.version); debug('Check what is on the list page now'); await expect( diff --git a/ts/test-mock/storage/pin_unpin_test.node.ts b/ts/test-mock/storage/pin_unpin_test.node.ts index d892adb155..f5d8f75708 100644 --- a/ts/test-mock/storage/pin_unpin_test.node.ts +++ b/ts/test-mock/storage/pin_unpin_test.node.ts @@ -47,9 +47,9 @@ describe('storage service', function (this: Mocha.Suite) { debug('Unpinning group via storage service'); { const state = await phone.expectStorageState('initial state'); - const newState = state.unpinGroup(group); + const modifiedState = state.unpinGroup(group); - await phone.setStorageState(newState); + const newState = await phone.setStorageState(modifiedState); await phone.sendFetchStorage({ timestamp: bootstrap.getTimestamp(), }); @@ -71,6 +71,7 @@ describe('storage service', function (this: Mocha.Suite) { const pinButton = window.getByRole('menuitem', { name: 'Pin chat', + exact: true, }); await pinButton.click(); @@ -123,6 +124,7 @@ describe('storage service', function (this: Mocha.Suite) { const pinButton = window.getByRole('menuitem', { name: 'Pin chat', + exact: true, }); // oxlint-disable-next-line no-await-in-loop await pinButton.click(); diff --git a/ts/test-mock/storage/sticker_test.node.ts b/ts/test-mock/storage/sticker_test.node.ts index 5ac3513a9b..ad9cc9792e 100644 --- a/ts/test-mock/storage/sticker_test.node.ts +++ b/ts/test-mock/storage/sticker_test.node.ts @@ -392,7 +392,7 @@ describe('stickers', function (this: Mocha.Suite) { { debug('expiring sticker pack via storage service'); const state = await phone.expectStorageState('initial state'); - const newState = state.updateRecord( + const modifiedState = state.updateRecord( getStickerPackRecordPredicate(STICKER_PACKS[0]), record => ({ stickerPack: { @@ -402,7 +402,7 @@ describe('stickers', function (this: Mocha.Suite) { }) ); - await phone.setStorageState(newState); + const newState = await phone.setStorageState(modifiedState); await phone.sendFetchStorage({ timestamp: bootstrap.getTimestamp(), });