mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-23 15:46:28 +08:00
fix(spec): Fix memory leak in NamespaceStoreSpec
This commit is contained in:
parent
c6c4403dfb
commit
6078983214
1 changed files with 11 additions and 7 deletions
|
@ -3,8 +3,12 @@ NamespaceStore = require '../../src/flux/stores/namespace-store'
|
|||
|
||||
describe "NamespaceStore", ->
|
||||
beforeEach ->
|
||||
@instance = null
|
||||
@constructor = NamespaceStore.constructor
|
||||
|
||||
afterEach ->
|
||||
@instance.stopListeningToAll()
|
||||
|
||||
it "should initialize current() using data saved in config", ->
|
||||
state =
|
||||
"id": "123",
|
||||
|
@ -13,16 +17,16 @@ describe "NamespaceStore", ->
|
|||
"organization_unit": "label"
|
||||
|
||||
spyOn(atom.config, 'get').andCallFake -> state
|
||||
instance = new @constructor
|
||||
expect(instance.current().id).toEqual(state['id'])
|
||||
expect(instance.current().emailAddress).toEqual(state['email_address'])
|
||||
@instance = new @constructor
|
||||
expect(@instance.current().id).toEqual(state['id'])
|
||||
expect(@instance.current().emailAddress).toEqual(state['email_address'])
|
||||
|
||||
it "should initialize current() to null if data is not present", ->
|
||||
spyOn(atom.config, 'get').andCallFake -> null
|
||||
instance = new @constructor
|
||||
expect(instance.current()).toEqual(null)
|
||||
@instance = new @constructor
|
||||
expect(@instance.current()).toEqual(null)
|
||||
|
||||
it "should initialize current() to null if data is invalid", ->
|
||||
spyOn(atom.config, 'get').andCallFake -> "this isn't an object"
|
||||
instance = new @constructor
|
||||
expect(instance.current()).toEqual(null)
|
||||
@instance = new @constructor
|
||||
expect(@instance.current()).toEqual(null)
|
||||
|
|
Loading…
Reference in a new issue