Mailspring/spec/models/category-spec.coffee
Juan Tejada b5fa97bc7a fix(category-store): Fix issue with observables in CategoryStore
- Removes use of observables from category store and keeps a big cache
  of categories per account
- Upates Category Observables with new helper observables
- Updates CategoryPicker and AccountSidebarStore to use observables
- Misc fixes
2016-01-08 18:03:18 -08:00

50 lines
1.8 KiB
CoffeeScript

{Category, Label} = require 'nylas-exports'
describe 'Category', ->
describe '_initCategoryTypes', ->
it 'assigns type correctly when it is a user category', ->
cat = new Label
cat.name = undefined
cat._initCategoryTypes()
expect(cat.isUserCategory()).toBe true
expect(cat.isStandardCategory()).toBe false
expect(cat.isHiddenCategory()).toBe false
expect(cat.isLockedCategory()).toBe false
it 'assigns type correctly when it is a standard category', ->
cat = new Label
cat.name = 'inbox'
cat._initCategoryTypes()
expect(cat.isUserCategory()).toBe false
expect(cat.isStandardCategory()).toBe true
expect(cat.isHiddenCategory()).toBe false
expect(cat.isLockedCategory()).toBe false
it 'assigns type for `important` category when should not show important', ->
cat = new Label
cat.name = 'important'
cat._initCategoryTypes()
expect(cat.isUserCategory()).toBe false
expect(cat.isStandardCategory(false)).toBe false
expect(cat.isHiddenCategory()).toBe true
expect(cat.isLockedCategory()).toBe false
it 'assigns type correctly when it is a hidden category', ->
cat = new Label
cat.name = 'archive'
cat._initCategoryTypes()
expect(cat.isUserCategory()).toBe false
expect(cat.isStandardCategory()).toBe true
expect(cat.isHiddenCategory()).toBe true
expect(cat.isLockedCategory()).toBe false
it 'assigns type correctly when it is a locked category', ->
cat = new Label
cat.name = 'sent'
cat._initCategoryTypes()
expect(cat.isUserCategory()).toBe false
expect(cat.isStandardCategory()).toBe true
expect(cat.isHiddenCategory()).toBe true
expect(cat.isLockedCategory()).toBe false