mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-26 20:56:34 +00:00
fix: broken tests due to orphaned notifier tests (#525)
The `NotifierService` was removed in 934d287, but for some reason, the CI servers didn't report an error because we forgot to delete the corresponding test file. Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
This commit is contained in:
parent
ff8e16b4ac
commit
b0d13eee3b
@ -1,51 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const m = require('mochainon');
|
|
||||||
const angular = require('angular');
|
|
||||||
require('angular-mocks');
|
|
||||||
|
|
||||||
describe('Browser: Notifier', function() {
|
|
||||||
|
|
||||||
beforeEach(angular.mock.module(
|
|
||||||
require('../../../lib/gui/utils/notifier/notifier')
|
|
||||||
));
|
|
||||||
|
|
||||||
describe('NotifierService', function() {
|
|
||||||
|
|
||||||
let $rootScope;
|
|
||||||
let NotifierService;
|
|
||||||
|
|
||||||
beforeEach(angular.mock.inject(function(_$rootScope_, _NotifierService_) {
|
|
||||||
$rootScope = _$rootScope_;
|
|
||||||
NotifierService = _NotifierService_;
|
|
||||||
}));
|
|
||||||
|
|
||||||
it('should be able to emit an event without data', function() {
|
|
||||||
let spy = m.sinon.spy();
|
|
||||||
NotifierService.subscribe($rootScope, 'foobar', spy);
|
|
||||||
NotifierService.emit('foobar');
|
|
||||||
m.chai.expect(spy).to.have.been.calledOnce;
|
|
||||||
m.chai.expect(spy).to.have.been.calledWith(undefined);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should be able to emit an event with data', function() {
|
|
||||||
let spy = m.sinon.spy();
|
|
||||||
NotifierService.subscribe($rootScope, 'foobar', spy);
|
|
||||||
NotifierService.emit('foobar', 'Hello');
|
|
||||||
m.chai.expect(spy).to.have.been.calledOnce;
|
|
||||||
m.chai.expect(spy).to.have.been.calledWith('Hello');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should emit the correct event', function() {
|
|
||||||
let spy1 = m.sinon.spy();
|
|
||||||
let spy2 = m.sinon.spy();
|
|
||||||
NotifierService.subscribe($rootScope, 'foobar', spy1);
|
|
||||||
NotifierService.subscribe($rootScope, 'foobaz', spy2);
|
|
||||||
NotifierService.emit('foobar');
|
|
||||||
m.chai.expect(spy1).to.have.been.calledOnce;
|
|
||||||
m.chai.expect(spy2).to.not.have.been.called;
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
Loading…
x
Reference in New Issue
Block a user