refactor(web): dependency management (#2386)
This commit is contained in:
@@ -298,7 +298,7 @@ describe('online conflict handling', function () {
|
||||
await this.application.mutator.setItemDirty(note)
|
||||
this.expectedItemCount++
|
||||
|
||||
await this.application.changeAndSaveItem(
|
||||
await this.application.changeAndSaveItem.execute(
|
||||
note,
|
||||
(mutator) => {
|
||||
// client A
|
||||
@@ -332,7 +332,7 @@ describe('online conflict handling', function () {
|
||||
await this.application.mutator.setItemDirty(note)
|
||||
this.expectedItemCount++
|
||||
|
||||
await this.application.changeAndSaveItem(
|
||||
await this.application.changeAndSaveItem.execute(
|
||||
note,
|
||||
(mutator) => {
|
||||
// client A
|
||||
@@ -602,15 +602,17 @@ describe('online conflict handling', function () {
|
||||
*/
|
||||
let tag = await Factory.createMappedTag(this.application)
|
||||
let note = await Factory.createMappedNote(this.application)
|
||||
tag = await this.application.changeAndSaveItem(
|
||||
tag,
|
||||
(mutator) => {
|
||||
mutator.e2ePendingRefactor_addItemAsRelationship(note)
|
||||
},
|
||||
undefined,
|
||||
undefined,
|
||||
syncOptions,
|
||||
)
|
||||
tag = (
|
||||
await this.application.changeAndSaveItem.execute(
|
||||
tag,
|
||||
(mutator) => {
|
||||
mutator.e2ePendingRefactor_addItemAsRelationship(note)
|
||||
},
|
||||
undefined,
|
||||
undefined,
|
||||
syncOptions,
|
||||
)
|
||||
).getValue()
|
||||
await this.application.mutator.setItemDirty(note)
|
||||
this.expectedItemCount += 2
|
||||
|
||||
@@ -732,39 +734,42 @@ describe('online conflict handling', function () {
|
||||
})
|
||||
|
||||
/** This test takes too long on Docker CI */
|
||||
it.skip('registering for account with bulk offline data belonging to another account should be error-free', async function () {
|
||||
/**
|
||||
* When performing a multi-page sync request where we are uploading data imported from a backup,
|
||||
* if the first page of the sync request returns conflicted items keys, we rotate their UUID.
|
||||
* The second page of sync waiting to be sent up is still encrypted with the old items key UUID.
|
||||
* This causes a problem because when that second page is returned as conflicts, we will be looking
|
||||
* for an items_key_id that no longer exists (has been rotated). Rather than modifying the entire
|
||||
* sync paradigm to allow multi-page requests to consider side-effects of each page, we will instead
|
||||
* take the approach of making sure the decryption function is liberal with regards to searching
|
||||
* for the right items key. It will now consider (as a result of this test) an items key as being
|
||||
* the correct key to decrypt an item if the itemskey.uuid == item.items_key_id OR if the itemsKey.duplicateOf
|
||||
* value is equal to item.items_key_id.
|
||||
*/
|
||||
it.skip(
|
||||
'registering for account with bulk offline data belonging to another account should be error-free',
|
||||
async function () {
|
||||
/**
|
||||
* When performing a multi-page sync request where we are uploading data imported from a backup,
|
||||
* if the first page of the sync request returns conflicted items keys, we rotate their UUID.
|
||||
* The second page of sync waiting to be sent up is still encrypted with the old items key UUID.
|
||||
* This causes a problem because when that second page is returned as conflicts, we will be looking
|
||||
* for an items_key_id that no longer exists (has been rotated). Rather than modifying the entire
|
||||
* sync paradigm to allow multi-page requests to consider side-effects of each page, we will instead
|
||||
* take the approach of making sure the decryption function is liberal with regards to searching
|
||||
* for the right items key. It will now consider (as a result of this test) an items key as being
|
||||
* the correct key to decrypt an item if the itemskey.uuid == item.items_key_id OR if the itemsKey.duplicateOf
|
||||
* value is equal to item.items_key_id.
|
||||
*/
|
||||
|
||||
/** Create bulk data belonging to another account and sync */
|
||||
const largeItemCount = SyncUpDownLimit + 10
|
||||
await Factory.createManyMappedNotes(this.application, largeItemCount)
|
||||
await this.application.sync.sync(syncOptions)
|
||||
const priorData = this.application.items.items
|
||||
/** Create bulk data belonging to another account and sync */
|
||||
const largeItemCount = SyncUpDownLimit + 10
|
||||
await Factory.createManyMappedNotes(this.application, largeItemCount)
|
||||
await this.application.sync.sync(syncOptions)
|
||||
const priorData = this.application.items.items
|
||||
|
||||
/** Register new account and import this same data */
|
||||
const newApp = await Factory.signOutApplicationAndReturnNew(this.application)
|
||||
await Factory.registerUserToApplication({
|
||||
application: newApp,
|
||||
email: Utils.generateUuid(),
|
||||
password: Utils.generateUuid(),
|
||||
})
|
||||
await newApp.mutator.emitItemsFromPayloads(priorData.map((i) => i.payload))
|
||||
await newApp.sync.markAllItemsAsNeedingSyncAndPersist()
|
||||
await newApp.sync.sync(syncOptions)
|
||||
expect(newApp.payloads.invalidPayloads.length).to.equal(0)
|
||||
await Factory.safeDeinit(newApp)
|
||||
}).timeout(80000)
|
||||
/** Register new account and import this same data */
|
||||
const newApp = await Factory.signOutApplicationAndReturnNew(this.application)
|
||||
await Factory.registerUserToApplication({
|
||||
application: newApp,
|
||||
email: Utils.generateUuid(),
|
||||
password: Utils.generateUuid(),
|
||||
})
|
||||
await newApp.mutator.emitItemsFromPayloads(priorData.map((i) => i.payload))
|
||||
await newApp.sync.markAllItemsAsNeedingSyncAndPersist()
|
||||
await newApp.sync.sync(syncOptions)
|
||||
expect(newApp.payloads.invalidPayloads.length).to.equal(0)
|
||||
await Factory.safeDeinit(newApp)
|
||||
},
|
||||
).timeout(80000)
|
||||
|
||||
it('importing data belonging to another account should not result in duplication', async function () {
|
||||
/** Create primary account and export data */
|
||||
@@ -801,7 +806,7 @@ describe('online conflict handling', function () {
|
||||
await createSyncedNoteWithTag(this.application)
|
||||
const tag = this.application.items.getDisplayableTags()[0]
|
||||
const note2 = await Factory.createMappedNote(this.application)
|
||||
await this.application.changeAndSaveItem(tag, (mutator) => {
|
||||
await this.application.changeAndSaveItem.execute(tag, (mutator) => {
|
||||
mutator.e2ePendingRefactor_addItemAsRelationship(note2)
|
||||
})
|
||||
let backupFile = await this.application.createEncryptedBackupFileForAutomatedDesktopBackups()
|
||||
|
||||
@@ -98,7 +98,7 @@ describe('offline syncing', () => {
|
||||
this.expectedItemCount++
|
||||
await this.application.sync.sync(syncOptions)
|
||||
this.application = await Factory.signOutApplicationAndReturnNew(this.application)
|
||||
expect(this.application.noAccount()).to.equal(true)
|
||||
expect(this.application.getUser()).to.not.be.ok
|
||||
expect(this.application.sessions.isSignedIn()).to.equal(false)
|
||||
expect(this.application.sessions.getUser()).to.not.be.ok
|
||||
})
|
||||
})
|
||||
|
||||
@@ -600,7 +600,7 @@ describe('online syncing', function () {
|
||||
it('saving an item after sync should persist it with content property', async function () {
|
||||
const note = await Factory.createMappedNote(this.application)
|
||||
const text = Factory.randomString(10000)
|
||||
await this.application.changeAndSaveItem(
|
||||
await this.application.changeAndSaveItem.execute(
|
||||
note,
|
||||
(mutator) => {
|
||||
mutator.text = text
|
||||
@@ -1015,7 +1015,7 @@ describe('online syncing', function () {
|
||||
it('deleting an item permanently should include it in PayloadEmitSource.PreSyncSave item change observer', async function () {
|
||||
let conditionMet = false
|
||||
|
||||
this.application.streamItems([ContentType.TYPES.Note], async ({ removed, source }) => {
|
||||
this.application.items.streamItems([ContentType.TYPES.Note], async ({ removed, source }) => {
|
||||
if (source === PayloadEmitSource.PreSyncSave && removed.length === 1) {
|
||||
conditionMet = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user