Mailspring/spec-nylas/stores/namespace-store-spec.coffee
Ben Gotow b194d7fb37 fix(mailto): Handle mailto on application launch, populate NamespaceStore synchronously
Summary:
atom-window `sendMessage` was not the same as `browserWindow.webContents.send`. WTF.

Save current namespace to config.cson so that it is never null when window opens

Don't re-create thread view on namespace change unless the namespace has changed

Tests for NamespaceStore state

Push worker immediately in workerForNamcespace to avoid creating two connections per namespace

Allow \n to be put into sreaming buffer, but only one

Clear streaming buffer when we're reconnecting to avoid processing same deltas twice (because of 400msec throttle)

Make `onProcessBuffer` more elegant—No functional changes

Test Plan: Run tests!

Reviewers: evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D1551
2015-05-21 18:08:29 -07:00

27 lines
No EOL
976 B
CoffeeScript

_ = require 'underscore'
NamespaceStore = require '../../src/flux/stores/namespace-store'
describe "NamespaceStore", ->
beforeEach ->
@constructor = NamespaceStore.constructor
it "should initialize current() using data saved in config", ->
state =
"id": "123",
"email_address":"bengotow@gmail.com",
"object":"namespace"
spyOn(atom.config, 'get').andCallFake -> state
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)
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)