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:
Evan Morikawa 2015-10-09 15:41:28 -07:00
parent ecf120729a
commit abc4a6116e
2 changed files with 47 additions and 52 deletions

View file

@ -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")

View file

@ -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")