2014-06-17 09:49:15 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var TestHelper = require('../../TestHelper');
|
|
|
|
|
|
|
|
/* global bootstrapBpmnJS, inject */
|
|
|
|
|
|
|
|
var fs = require('fs');
|
|
|
|
|
|
|
|
var Events = require('diagram-js/lib/core/EventBus');
|
|
|
|
|
2014-08-01 05:16:59 +00:00
|
|
|
var Viewer = require('../../../lib/Viewer');
|
2014-06-30 14:56:43 +00:00
|
|
|
|
2014-06-17 09:49:15 +00:00
|
|
|
|
2014-06-18 09:45:30 +00:00
|
|
|
describe('environment - mocking', function() {
|
2014-06-17 09:49:15 +00:00
|
|
|
|
|
|
|
var diagramXML = fs.readFileSync('test/fixtures/bpmn/simple.bpmn', 'utf8');
|
|
|
|
|
|
|
|
var mockEvents, bootstrapCalled;
|
|
|
|
|
2014-06-30 14:56:43 +00:00
|
|
|
beforeEach(bootstrapBpmnJS(diagramXML, {
|
|
|
|
modules: Viewer.prototype._modules
|
|
|
|
}, function() {
|
2014-06-17 09:49:15 +00:00
|
|
|
mockEvents = new Events();
|
|
|
|
|
|
|
|
bootstrapCalled = true;
|
|
|
|
|
|
|
|
return {
|
|
|
|
eventBus: mockEvents
|
|
|
|
};
|
|
|
|
}));
|
|
|
|
|
|
|
|
afterEach(function() {
|
|
|
|
bootstrapCalled = false;
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('should use spy', inject(function(eventBus) {
|
|
|
|
|
|
|
|
expect(eventBus).toEqual(mockEvents);
|
|
|
|
expect(bootstrapCalled).toBe(true);
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('should reparse bootstrap code', inject(function(eventBus) {
|
|
|
|
|
|
|
|
expect(bootstrapCalled).toBe(true);
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('should inject bpmnjs', inject(function(bpmnjs) {
|
|
|
|
|
|
|
|
expect(bpmnjs).toBeDefined();
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|