2019-03-05 03:03:12 +08:00
|
|
|
import BadgeStore from '../../src/flux/stores/badge-store';
|
2018-01-24 09:35:09 +08:00
|
|
|
|
|
|
|
describe('BadgeStore', () =>
|
|
|
|
describe('_setBadgeForCount', () =>
|
|
|
|
it('should set the badge correctly', function() {
|
|
|
|
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+');
|
|
|
|
})));
|