chore: test timeout
This commit is contained in:
@@ -11,17 +11,19 @@ export async function safeDeinit(application) {
|
|||||||
await application.storage.awaitPersist()
|
await application.storage.awaitPersist()
|
||||||
|
|
||||||
/** Limit waiting to 1s */
|
/** Limit waiting to 1s */
|
||||||
await Promise.race([sleep(1, 'Deinit'), application.sync?.awaitCurrentSyncs()])
|
await Promise.race([sleep(1, 'Deinit', true), application.sync?.awaitCurrentSyncs()])
|
||||||
|
|
||||||
await application.prepareForDeinit()
|
await application.prepareForDeinit()
|
||||||
|
|
||||||
application.deinit(DeinitMode.Soft, DeinitSource.SignOut)
|
application.deinit(DeinitMode.Soft, DeinitSource.SignOut)
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function sleep(seconds, reason) {
|
export async function sleep(seconds, reason, noLog = false) {
|
||||||
console.warn(`Test sleeping for ${seconds}s. Reason: ${reason}`)
|
if (!noLog) {
|
||||||
|
console.warn(`Test sleeping for ${seconds}s. Reason: ${reason}`)
|
||||||
|
}
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve) => {
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
resolve()
|
resolve()
|
||||||
}, seconds * 1000)
|
}, seconds * 1000)
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import { createItemParams, createNoteParams, createTagParams } from './Items.js'
|
|||||||
export const TenSecondTimeout = 10_000
|
export const TenSecondTimeout = 10_000
|
||||||
export const TwentySecondTimeout = 20_000
|
export const TwentySecondTimeout = 20_000
|
||||||
export const ThirtySecondTimeout = 30_000
|
export const ThirtySecondTimeout = 30_000
|
||||||
|
export const SixtySecondTimeout = 60_000
|
||||||
|
|
||||||
export const syncOptions = {
|
export const syncOptions = {
|
||||||
checkIntegrity: true,
|
checkIntegrity: true,
|
||||||
|
|||||||
@@ -540,7 +540,7 @@ describe('online syncing', function () {
|
|||||||
await this.application.sync.sync(syncOptions)
|
await this.application.sync.sync(syncOptions)
|
||||||
const rawPayloads = await this.application.storage.getAllRawPayloads()
|
const rawPayloads = await this.application.storage.getAllRawPayloads()
|
||||||
expect(rawPayloads.length).to.equal(this.expectedItemCount)
|
expect(rawPayloads.length).to.equal(this.expectedItemCount)
|
||||||
}).timeout(Factory.TwentySecondTimeout)
|
}).timeout(Factory.SixtySecondTimeout)
|
||||||
|
|
||||||
it('should handle downloading with sync pagination', async function () {
|
it('should handle downloading with sync pagination', async function () {
|
||||||
const largeItemCount = SyncUpDownLimit + 10
|
const largeItemCount = SyncUpDownLimit + 10
|
||||||
@@ -567,7 +567,7 @@ describe('online syncing', function () {
|
|||||||
|
|
||||||
const rawPayloads = await this.application.storage.getAllRawPayloads()
|
const rawPayloads = await this.application.storage.getAllRawPayloads()
|
||||||
expect(rawPayloads.length).to.equal(this.expectedItemCount)
|
expect(rawPayloads.length).to.equal(this.expectedItemCount)
|
||||||
}).timeout(30000)
|
}).timeout(Factory.SixtySecondTimeout)
|
||||||
|
|
||||||
it('syncing an item should storage it encrypted', async function () {
|
it('syncing an item should storage it encrypted', async function () {
|
||||||
const note = await Factory.createMappedNote(this.application)
|
const note = await Factory.createMappedNote(this.application)
|
||||||
|
|||||||
Reference in New Issue
Block a user