Example #1
0
function mockPlugin() {
  return {
    initialize: sinon.stub(),
    batchStart: sinon.stub(),
    jobStart: sinon.stub(),
    beforeRender: sinon.stub(),
    afterRender: sinon.stub(),
    onError: sinon.stub(),
    jobEnd: sinon.stub(),
    batchEnd: sinon.stub(),
    shutDown: sinon.stub(),
  };
}
Example #2
0
const jobs = {
  foo: makeJob(),
  bar: makeJob(),
  baz: {
    name: 'baz',
    data: {},
  },
};

jobs.bar.name = 'bar'; // component not registered

const req = {};
const res = {};
const _strategies = {
  [COMPONENT_NAME]: sinon.stub().returns('html'),
  baz: sinon.stub().returns(undefined),
};
const config = {
  getComponent(name) {
    return _strategies[name];
  },
  plugins: {},
};

describe('BatchManager', () => {
  let plugins;
  let manager;

  beforeEach(() => {
    plugins = [