mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 11:22:19 +03:00
1520122483
no issue - https://github.com/emberjs/ember-mocha/blob/master/docs/migration.md#upgrading-to-the-new-testing-apis - deleted tests files which had no specific tests - migrated unskipped component unit tests to integration tests
32 lines
824 B
JavaScript
32 lines
824 B
JavaScript
import sinon from 'sinon';
|
|
import {describe, it} from 'mocha';
|
|
import {expect} from 'chai';
|
|
import {setupTest} from 'ember-mocha';
|
|
|
|
describe('Unit: Service: event-bus', function () {
|
|
setupTest();
|
|
|
|
it('works', function () {
|
|
let service = this.owner.lookup('service:event-bus');
|
|
let eventHandler = sinon.spy();
|
|
|
|
service.subscribe('test-event', eventHandler);
|
|
|
|
service.publish('test-event', 'test');
|
|
|
|
service.unsubscribe('test-event', eventHandler);
|
|
|
|
service.publish('test-event', 'test two');
|
|
|
|
expect(
|
|
eventHandler.calledOnce,
|
|
'event handler only triggered once'
|
|
).to.be.true;
|
|
|
|
expect(
|
|
eventHandler.calledWith('test'),
|
|
'event handler was passed correct arguments'
|
|
).to.be.true;
|
|
});
|
|
});
|