mail/test/unit/util/status-display-test.js

41 lines
1.2 KiB
JavaScript
Raw Normal View History

2014-11-21 07:33:22 -05:00
'use strict';
describe('Status Display Service unit test', function() {
var statusDisplay, logInfoStub, rootScope, broadcastSpy;
2014-11-21 07:33:22 -05:00
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');
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();
statusDisplay.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() {
statusDisplay.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
});
});