chore: add quota usage e2e tests (#2438)
* chore: add quota usage e2e tests * chore: add moving from shared to shared vault quota e2e test * chore: fix test suite name * chore: fix awaiting for notifications to propagate * chore: fix awaiting for notifications processing
This commit is contained in:
@@ -53,3 +53,23 @@ export async function awaitPromiseOrThrow(promise, maxWait, reason) {
|
||||
return result
|
||||
})
|
||||
}
|
||||
|
||||
export async function awaitPromiseOrDoNothing(promise, maxWait, reason) {
|
||||
let timer = undefined
|
||||
|
||||
// Create a promise that resolves in <maxWait> milliseconds
|
||||
const timeout = new Promise((resolve, reject) => {
|
||||
timer = setTimeout(() => {
|
||||
clearTimeout(timer)
|
||||
const message = reason || `Promise timed out after ${maxWait} milliseconds: ${reason}`
|
||||
console.warn(message)
|
||||
resolve()
|
||||
}, maxWait * 1000)
|
||||
})
|
||||
|
||||
// Returns a race between our timeout and the passed in promise
|
||||
return Promise.race([promise, timeout]).then((result) => {
|
||||
clearTimeout(timer)
|
||||
return result
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user