mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-10-17 00:26:13 +08:00
fix(specs): Fix intermittent async error and max event listener leak
An absolute ContactStore spec was causing the listener leak by re-initializing the store and not cleaning it up. Intermittent theme manager failing spec might be caused due to timing of the theme activation
This commit is contained in:
parent
ecf120729a
commit
abc4a6116e
2 changed files with 47 additions and 52 deletions
|
@ -27,16 +27,11 @@ describe "ContactStore", ->
|
||||||
ContactStore._contactCache = []
|
ContactStore._contactCache = []
|
||||||
ContactStore._fetchOffset = 0
|
ContactStore._fetchOffset = 0
|
||||||
ContactStore._accountId = null
|
ContactStore._accountId = null
|
||||||
|
ContactRankingStore.reset()
|
||||||
|
|
||||||
afterEach ->
|
afterEach ->
|
||||||
atom.testOrganizationUnit = null
|
atom.testOrganizationUnit = null
|
||||||
|
|
||||||
it "initializes the cache from the DB", ->
|
|
||||||
spyOn(DatabaseStore, "findAll").andCallFake -> Promise.resolve([])
|
|
||||||
ContactStore.constructor()
|
|
||||||
expect(ContactStore._contactCache.length).toBe 0
|
|
||||||
expect(ContactStore._fetchOffset).toBe 0
|
|
||||||
|
|
||||||
describe "when the Account updates from null to valid", ->
|
describe "when the Account updates from null to valid", ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
spyOn(ContactStore, "_refreshCache")
|
spyOn(ContactStore, "_refreshCache")
|
||||||
|
|
|
@ -318,7 +318,7 @@ describe "ThemeManager", ->
|
||||||
[stylesheetRemovedHandler, stylesheetAddedHandler, stylesheetsChangedHandler] = []
|
[stylesheetRemovedHandler, stylesheetAddedHandler, stylesheetsChangedHandler] = []
|
||||||
|
|
||||||
waitsForPromise ->
|
waitsForPromise ->
|
||||||
themeManager.activateThemes()
|
themeManager.activateThemes().then ->
|
||||||
|
|
||||||
runs ->
|
runs ->
|
||||||
atom.styles.onDidRemoveStyleElement styleElementRemovedHandler = jasmine.createSpy("styleElementRemovedHandler")
|
atom.styles.onDidRemoveStyleElement styleElementRemovedHandler = jasmine.createSpy("styleElementRemovedHandler")
|
||||||
|
|
Loading…
Add table
Reference in a new issue