Skip to content

Commit

Permalink
feat: update draft deploy (#702)
Browse files Browse the repository at this point in the history
* feat: update draft deploy

* test: add parameter to test
  • Loading branch information
TwelveNights committed Jan 31, 2022
1 parent 89a288d commit 78f8d19
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions src/management/ActionsManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ class ActionsManager {
* @param {object} params Action parameters.
* @param {string} params.id Action ID.
* @param {string} params.version_id Action ID.
* @param {boolean} params.update_draft Update draft
* @param {Function} [cb] Callback function.
* @returns {Promise|undefined}
*/
Expand All @@ -542,11 +543,18 @@ class ActionsManager {
delete params.action_id;
}

const body = {};

if (params.update_draft) {
body.update_draft = params.update_draft;
delete params.update_draft;
}

if (cb && cb instanceof Function) {
return this.actionVersionDeploy.create(params, {}, cb);
return this.actionVersionDeploy.create(params, body, cb);
}

return this.actionVersionDeploy.create(params, {});
return this.actionVersionDeploy.create(params, body);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion test/management/actions.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ describe('ActionsManager', () => {
it('should perform a post request', function (done) {
const { request } = this;

this.actions.deployVersion({ action_id, version_id }).then(() => {
this.actions.deployVersion({ action_id, version_id, update_draft: true }).then(() => {
expect(request.isDone()).to.be.true;

done();
Expand Down

0 comments on commit 78f8d19

Please sign in to comment.