diff --git a/src/publish.js b/src/publish.js index 23c7c0704..1d60cee89 100644 --- a/src/publish.js +++ b/src/publish.js @@ -119,6 +119,7 @@ module.exports = function strain() { .withConfigPurgeAPI(argv.apiConfigPurge) .withFilter(argv.only, argv.exclude) .withCustomVCLs(argv.customVCL) + .withDispatchVersion(argv.dispatchVersion) .run(); }, }; diff --git a/test/testPublishCli.js b/test/testPublishCli.js index ba0175e82..2dd162351 100644 --- a/test/testPublishCli.js +++ b/test/testPublishCli.js @@ -41,6 +41,7 @@ describe('hlx publish', () => { mockPublish.withGithubToken.returnsThis(); mockPublish.withFilter.returnsThis(); mockPublish.withCustomVCLs.returnsThis(); + mockPublish.withDispatchVersion.returnsThis(); mockPublish.run.returnsThis(); }); @@ -73,6 +74,7 @@ describe('hlx publish', () => { sinon.assert.calledWith(mockPublish.withPublishAPI, 'foobar.api'); sinon.assert.calledWith(mockPublish.withDryRun, true); sinon.assert.calledWith(mockPublish.withCustomVCLs, []); + sinon.assert.calledWith(mockPublish.withDispatchVersion, undefined); }); it('hlx publish works with minimal arguments', () => { @@ -91,6 +93,7 @@ describe('hlx publish', () => { sinon.assert.calledWith(mockPublish.withFastlyNamespace, 'hlx'); // TODO !! sinon.assert.calledWith(mockPublish.withFastlyAuth, 'secret-key'); sinon.assert.calledWith(mockPublish.withCustomVCLs, []); + sinon.assert.calledWith(mockPublish.withDispatchVersion, undefined); sinon.assert.calledOnce(mockPublish.run); }); @@ -128,4 +131,18 @@ describe('hlx publish', () => { assert.fail('publish w/o github token should fail.'); }); + + it('hlx publish handles dispatch-version', () => { + new CLI() + .withCommandExecutor('publish', mockPublish) + .run(['publish', + '--wsk-auth', 'secret-key', + '--wsk-namespace', 'hlx', + '--fastly-auth', 'secret-key', + '--fastly-namespace', 'hlx', + '--dispatch-version', 'ci1', + ]); + + sinon.assert.calledWith(mockPublish.withDispatchVersion, 'ci1'); + }); });