2014-11-21 07:33:22 -05:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
describe('Status Display Service unit test', function() {
|
2014-11-26 15:12:40 -05:00
|
|
|
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');
|
2014-11-26 15:12:40 -05:00
|
|
|
rootScope = $injector.get('$rootScope');
|
|
|
|
broadcastSpy = sinon.spy(rootScope, '$broadcast');
|
2014-11-21 07:33:22 -05:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(function() {
|
|
|
|
logInfoStub.restore();
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('update', function() {
|
2014-11-26 15:12:40 -05:00
|
|
|
it('should work', function() {
|
2014-11-21 07:33:22 -05:00
|
|
|
var message = 'Tada!',
|
|
|
|
time = new Date();
|
|
|
|
|
2014-11-26 15:12:40 -05:00
|
|
|
statusDisplay.update(message, time);
|
2014-11-21 07:33:22 -05:00
|
|
|
|
2014-11-26 15:12:40 -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() {
|
2014-11-26 15:12:40 -05:00
|
|
|
it('should work', function() {
|
|
|
|
statusDisplay.setSearching(true);
|
2014-11-21 07:33:22 -05:00
|
|
|
|
2014-11-26 15:12:40 -05:00
|
|
|
expect(broadcastSpy.withArgs('searching', true).calledOnce).to.be.true;
|
|
|
|
});
|
2014-11-21 07:33:22 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
});
|