1
0
mirror of https://github.com/moparisthebest/mail synced 2024-12-21 23:08:50 -05:00
mail/test/unit/util/status-display-test.js

49 lines
1.4 KiB
JavaScript
Raw Normal View History

2014-11-21 07:33:22 -05:00
'use strict';
describe('Status Service unit test', function() {
var status, logInfoStub, rootScope, broadcastSpy;
2014-11-21 07:33:22 -05:00
beforeEach(function() {
angular.module('status-test', ['woUtil']);
angular.mock.module('status-test');
2014-11-21 07:33:22 -05:00
angular.mock.inject(function($injector, axe) {
logInfoStub = sinon.stub(axe, 'info');
status = $injector.get('status');
rootScope = $injector.get('$rootScope');
broadcastSpy = sinon.spy(rootScope, '$broadcast');
2014-11-21 07:33:22 -05:00
});
});
afterEach(function() {
logInfoStub.restore();
});
describe('update', function() {
it('should work', function() {
2014-11-21 07:33:22 -05:00
var message = 'Tada!',
time = new Date();
status.update(message, time);
2014-11-21 07:33:22 -05:00
expect(broadcastSpy.withArgs('status', message, time).calledOnce).to.be.true;
expect(logInfoStub.withArgs('status display', message).calledOnce).to.be.true;
});
2014-11-21 07:33:22 -05:00
});
describe('setSearching', function() {
it('should work', function() {
status.setSearching(true);
2014-11-21 07:33:22 -05:00
expect(broadcastSpy.withArgs('searching', true).calledOnce).to.be.true;
});
2014-11-21 07:33:22 -05:00
});
describe('setReading', function() {
it('should work', function() {
status.setReading(true);
expect(broadcastSpy.withArgs('read', true).calledOnce).to.be.true;
});
});
2014-11-21 07:33:22 -05:00
});