Mailspring/spec-nylas/stores/namespace-store-spec.coffee
Evan Morikawa 00c74cd1a9 WIP: This is the initial diff for new folders & labels.
Summary:
There are now two objects, Folders & Labels. These inherit from `Category`
(that's what Eben said they were using on the backend).

There are two separate tasks.

1. MoveToFolderTask
2. ApplyLabelsTask

It turns out that the semantics between the two are quite different.
The reverse operation for moving to a folder is a bit tricky.

As of 7-8-15, the Tasks are pretty much complete. I need to write tests
for them still and do some manual testing in the client.

Test Plan: Writing specs

Reviewers: bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D1724
2015-07-16 11:54:20 -04:00

28 lines
1,012 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"
"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'])
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)