2016-10-27 07:01:23 +08:00
|
|
|
Label = require('../../src/flux/models/label').default
|
2016-05-04 07:42:28 +08:00
|
|
|
BadgeStore = require('../../src/flux/stores/badge-store').default
|
2016-03-22 08:36:18 +08:00
|
|
|
|
|
|
|
describe "BadgeStore", ->
|
|
|
|
describe "_setBadgeForCount", ->
|
|
|
|
it "should set the badge correctly", ->
|
|
|
|
spyOn(BadgeStore, '_setBadge')
|
|
|
|
BadgeStore._unread = 0
|
|
|
|
BadgeStore._setBadgeForCount()
|
|
|
|
expect(BadgeStore._setBadge).toHaveBeenCalledWith("")
|
|
|
|
BadgeStore._unread = 1
|
|
|
|
BadgeStore._setBadgeForCount()
|
|
|
|
expect(BadgeStore._setBadge).toHaveBeenCalledWith("1")
|
|
|
|
BadgeStore._unread = 100
|
|
|
|
BadgeStore._setBadgeForCount()
|
|
|
|
expect(BadgeStore._setBadge).toHaveBeenCalledWith("100")
|
|
|
|
BadgeStore._unread = 1000
|
|
|
|
BadgeStore._setBadgeForCount()
|
|
|
|
expect(BadgeStore._setBadge).toHaveBeenCalledWith("999+")
|