diff --git a/packages/stack/communication/test/communication.spec.js b/packages/stack/communication/test/communication.spec.js index f0d63512a..5d34acab7 100644 --- a/packages/stack/communication/test/communication.spec.js +++ b/packages/stack/communication/test/communication.spec.js @@ -10,6 +10,15 @@ describe('stack/communication', () => { const { embark } = fakeEmbark(); beforeEach(() => { + embark.setConfig({ + communicationConfig: { + connection: { + host: 'localhost', + } + }, + embarkConfig: {} + }); + communication = new Communication(embark); communicationNodeLaunchFn = sinon.spy(done => { @@ -48,4 +57,13 @@ describe('stack/communication', () => { assert(communicationNodeLaunchFn.calledOnce); assert(doneCb.calledOnce); }); + + test('it should register artifact file from configuration', () => { + const pipelineRegisterHandler = sinon.spy((params, fn) => fn()); + embark.events.setCommandHandler('pipeline:register', pipelineRegisterHandler); + embark.plugins.emitAndRunActionsForEvent('pipeline:generateAll:before', {}, doneCb); + + assert(pipelineRegisterHandler.calledOnce); + assert(doneCb.calledOnce); + }); }); diff --git a/packages/utils/testing/src/lib/embark.js b/packages/utils/testing/src/lib/embark.js index 716ceb112..7be257e67 100644 --- a/packages/utils/testing/src/lib/embark.js +++ b/packages/utils/testing/src/lib/embark.js @@ -1,13 +1,10 @@ const sinon = require('sinon'); class Embark { - constructor(events, plugins) { + constructor(events, plugins, config) { this.events = events; this.plugins = plugins; - this.config = { - blockchainConfig: {} - }; - + this.config = config || {}; this.assert = new EmbarkAssert(this); this.logger = { @@ -23,8 +20,13 @@ class Embark { } teardown() { + this.config = {}; this.plugins.teardown(); } + + setConfig(config) { + this.config = config; + } } class EmbarkAssert { diff --git a/packages/utils/testing/src/lib/index.js b/packages/utils/testing/src/lib/index.js index 36a4538c7..0abad764d 100644 --- a/packages/utils/testing/src/lib/index.js +++ b/packages/utils/testing/src/lib/index.js @@ -2,11 +2,11 @@ const Embark = require('./embark'); const Events = require('./events'); const Plugins = require('./plugin'); -const fakeEmbark = () => { +const fakeEmbark = (config) => { const events = new Events(); const plugins = new Plugins(); - const embark = new Embark(events, plugins); + const embark = new Embark(events, plugins, config); return { embark, plugins