Skip to content

Commit a7ea119

Browse files
committed
chore: re-enable tests with changed behavior
1 parent 439caf8 commit a7ea119

File tree

1 file changed

+18
-32
lines changed

1 file changed

+18
-32
lines changed

packages/snjs/mocha/vaults/surviving.test.js

+18-32
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ describe('designated survival', function () {
5252
expect(vault.sharing.designatedSurvivor).to.equal(contactContext.userUuid)
5353
})
5454

55-
describe.skip('owner of a shared vault with a designated survivor removing the vault', () => {
56-
it('should not remove all users from the vault upon shared vault removal', async () => {
55+
describe('owner of a shared vault with a designated survivor removing the vault', () => {
56+
it('should remove all users from the vault upon shared vault removal', async () => {
5757
const { sharedVault, contactContext } =
5858
await Collaboration.createSharedVaultWithAcceptedInvite(context)
5959
secondContext = contactContext
@@ -74,23 +74,20 @@ describe('designated survival', function () {
7474
await secondContext.syncAndAwaitNotificationsProcessing()
7575
await thirdContext.syncAndAwaitNotificationsProcessing()
7676

77-
const sharedVaultUsers = await secondContext.vaultUsers.getSharedVaultUsersFromServer(sharedVault)
78-
expect(sharedVaultUsers.length).to.equal(2)
79-
8077
expect(context.vaults.getVault({ keySystemIdentifier: sharedVault.systemIdentifier }).isFailed()).to.be.true
8178
expect(context.keys.getPrimaryKeySystemRootKey(sharedVault.systemIdentifier)).to.be.undefined
8279
expect(context.keys.getKeySystemItemsKeys(sharedVault.systemIdentifier)).to.be.empty
8380

84-
expect(secondContext.vaults.getVault({ keySystemIdentifier: sharedVault.systemIdentifier }).getValue()).to.not.be.undefined
85-
expect(secondContext.keys.getPrimaryKeySystemRootKey(sharedVault.systemIdentifier)).to.not.be.undefined
86-
expect(secondContext.keys.getKeySystemItemsKeys(sharedVault.systemIdentifier)).to.not.be.empty
81+
expect(secondContext.vaults.getVault({ keySystemIdentifier: sharedVault.systemIdentifier }).isFailed()).to.be.true
82+
expect(secondContext.keys.getPrimaryKeySystemRootKey(sharedVault.systemIdentifier)).to.be.undefined
83+
expect(secondContext.keys.getKeySystemItemsKeys(sharedVault.systemIdentifier)).to.be.empty
8784

88-
expect(thirdContext.vaults.getVault({ keySystemIdentifier: sharedVault.systemIdentifier }).getValue()).to.not.be.undefined
89-
expect(thirdContext.keys.getPrimaryKeySystemRootKey(sharedVault.systemIdentifier)).to.not.be.undefined
90-
expect(thirdContext.keys.getKeySystemItemsKeys(sharedVault.systemIdentifier)).to.not.be.empty
85+
expect(thirdContext.vaults.getVault({ keySystemIdentifier: sharedVault.systemIdentifier }).isFailed()).to.be.true
86+
expect(thirdContext.keys.getPrimaryKeySystemRootKey(sharedVault.systemIdentifier)).to.be.undefined
87+
expect(thirdContext.keys.getKeySystemItemsKeys(sharedVault.systemIdentifier)).to.be.empty
9188
})
9289

93-
it('should transition items of the owner in the vault to the designated survivor', async () => {
90+
it('should not transition items of the owner in the vault to the designated survivor', async () => {
9491
const { sharedVault, contactContext } =
9592
await Collaboration.createSharedVaultWithAcceptedInvite(context)
9693
secondContext = contactContext
@@ -113,19 +110,14 @@ describe('designated survival', function () {
113110
await secondContext.syncAndAwaitNotificationsProcessing()
114111
await thirdContext.syncAndAwaitNotificationsProcessing()
115112

116-
const sharedVaultUsers = await secondContext.vaultUsers.getSharedVaultUsersFromServer(sharedVault)
117-
expect(sharedVaultUsers.length).to.equal(2)
118-
119113
const contactNote = secondContext.items.findItem(note.uuid)
120-
expect(contactNote.key_system_identifier).to.equal(sharedVault.systemIdentifier)
121-
expect(contactNote.user_uuid).to.equal(secondContext.userUuid)
114+
expect(contactNote).to.be.undefined
122115

123116
const thirdPartyNote = thirdContext.items.findItem(note.uuid)
124-
expect(thirdPartyNote.key_system_identifier).to.equal(sharedVault.systemIdentifier)
125-
expect(thirdPartyNote.user_uuid).to.equal(secondContext.userUuid)
117+
expect(thirdPartyNote).to.be.undefined
126118
})
127119

128-
it('should still allow to download files of the owner in the vault', async () => {
120+
it('should not allow to download files of the owner in the vault', async () => {
129121
await context.activatePaidSubscriptionForUser()
130122

131123
const { sharedVault, contactContext } =
@@ -157,14 +149,10 @@ describe('designated survival', function () {
157149
await secondContext.syncAndAwaitNotificationsProcessing()
158150

159151
const sharedFileAfter = secondContext.items.findItem(uploadedFile.uuid)
160-
expect(sharedFileAfter).to.not.be.undefined
161-
expect(sharedFileAfter.remoteIdentifier).to.equal(uploadedFile.remoteIdentifier)
162-
163-
const downloadedBytes = await Files.downloadFile(secondContext.files, sharedFileAfter)
164-
expect(downloadedBytes).to.eql(buffer)
152+
expect(sharedFileAfter).to.be.undefined
165153
})
166154

167-
it('should transition vault ownership to the designated survivor', async () => {
155+
it('should not transition vault ownership to the designated survivor', async () => {
168156
const { sharedVault, contactContext } =
169157
await Collaboration.createSharedVaultWithAcceptedInvite(context)
170158
secondContext = contactContext
@@ -184,13 +172,11 @@ describe('designated survival', function () {
184172
await secondContext.syncAndAwaitNotificationsProcessing()
185173
await thirdContext.syncAndAwaitNotificationsProcessing()
186174

187-
const contactVault = secondContext.vaults.getVault({ keySystemIdentifier: sharedVault.systemIdentifier }).getValue()
188-
expect(contactVault.sharing.ownerUserUuid).to.not.equal(context.userUuid)
189-
expect(contactVault.sharing.ownerUserUuid).to.equal(secondContext.userUuid)
175+
const contactVaultOrError = secondContext.vaults.getVault({ keySystemIdentifier: sharedVault.systemIdentifier })
176+
expect(contactVaultOrError.isFailed()).to.be.true
190177

191-
const thirdPartyVault = thirdContext.vaults.getVault({ keySystemIdentifier: sharedVault.systemIdentifier }).getValue()
192-
expect(thirdPartyVault.sharing.ownerUserUuid).to.not.equal(context.userUuid)
193-
expect(thirdPartyVault.sharing.ownerUserUuid).to.equal(secondContext.userUuid)
178+
const thirdPartyVaultOrError = thirdContext.vaults.getVault({ keySystemIdentifier: sharedVault.systemIdentifier })
179+
expect(thirdPartyVaultOrError.isFailed()).to.be.true
194180
})
195181
})
196182

0 commit comments

Comments
 (0)