tests: fix memory leaks (#2389)

This commit is contained in:
Mo
2023-08-06 15:23:31 -05:00
committed by GitHub
parent d59e1befff
commit 8655bdb5dd
76 changed files with 3904 additions and 3840 deletions

View File

@@ -9,21 +9,24 @@ describe('vaults', function () {
let context
let vaults
afterEach(async function () {
await context.deinit()
localStorage.clear()
})
beforeEach(async function () {
localStorage.clear()
context = await Factory.createVaultsContextWithRealCrypto()
context = await Factory.createVaultsContextWithFakeCrypto()
await context.launch()
vaults = context.vaults
})
afterEach(async function () {
await context.deinit()
localStorage.clear()
sinon.restore()
context = undefined
vaults = undefined
})
describe('offline', function () {
it('should be able to create an offline vault', async () => {
const vault = await vaults.createRandomizedVault({
@@ -77,7 +80,7 @@ describe('vaults', function () {
await vaults.moveItemToVault(vault, note)
await context.deinit()
const recreatedContext = await Factory.createVaultsContextWithRealCrypto(appIdentifier)
const recreatedContext = await Factory.createVaultsContextWithFakeCrypto(appIdentifier)
await recreatedContext.launch()
const updatedNote = recreatedContext.items.findItem(note.uuid)
@@ -101,7 +104,7 @@ describe('vaults', function () {
await context.deinit()
const recreatedContext = await Factory.createVaultsContextWithRealCrypto(appIdentifier)
const recreatedContext = await Factory.createVaultsContextWithFakeCrypto(appIdentifier)
await recreatedContext.launch()
const notes = recreatedContext.notes
@@ -128,7 +131,7 @@ describe('vaults', function () {
await context.deinit()
const recreatedContext = await Factory.createVaultsContextWithRealCrypto(appIdentifier)
const recreatedContext = await Factory.createVaultsContextWithFakeCrypto(appIdentifier)
await recreatedContext.launch()
const updatedNote = recreatedContext.items.findItem(note.uuid)
@@ -181,7 +184,7 @@ describe('vaults', function () {
await vaults.moveItemToVault(vault, note)
await context.deinit()
const recreatedContext = await Factory.createVaultsContextWithRealCrypto(appIdentifier)
const recreatedContext = await Factory.createVaultsContextWithFakeCrypto(appIdentifier)
await recreatedContext.launch()
const updatedNote = recreatedContext.items.findItem(note.uuid)