tests: fix memory leaks (#2389)
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user