1
0
mirror of https://github.com/moparisthebest/mail synced 2024-12-11 01:52:18 -05:00
mail/test/unit/util/status-display-test.js
2014-11-26 21:12:40 +01:00

41 lines
1.2 KiB
JavaScript

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