diff --git a/packages/conventional-gitlab-releaser/src/index.js b/packages/conventional-gitlab-releaser/src/index.js index 19059569..c00dbec7 100644 --- a/packages/conventional-gitlab-releaser/src/index.js +++ b/packages/conventional-gitlab-releaser/src/index.js @@ -73,14 +73,12 @@ function conventionalGitlabReleaser (auth, changelogOpts, context, gitRawCommits return } - const url = `projects/${escape(context.owner + `/` + context.repository)}/repository/tags` + const url = `/projects/${escape(context.owner + `/` + context.repository)}/releases` const options = { endpoint: auth.url, body: { tag_name: chunk.keyCommit.version, - ref: chunk.keyCommit.hash, - message: 'Release ' + chunk.keyCommit.version, - release_description: chunk.log + description: chunk.log } } debug(`posting %o to the following URL - ${url}`, options) diff --git a/packages/conventional-gitlab-releaser/src/index.spec.js b/packages/conventional-gitlab-releaser/src/index.spec.js new file mode 100644 index 00000000..3922fe61 --- /dev/null +++ b/packages/conventional-gitlab-releaser/src/index.spec.js @@ -0,0 +1,37 @@ +'use strict' + +const chai = require('chai') +const mocha = require(`mocha`) +const conventionalGitlabReleaser = require('./index') + +const expect = chai.expect + +const beforeEach = mocha.beforeEach +const describe = mocha.describe +const it = mocha.it + +describe.only('index', function () { + beforeEach(function () { + this.chunk = { + committerDate: 'June 8, 2012', + gitTags: '' + } + }) + + it('should throw an error if no argument is passed', function () { + expect(conventionalGitlabReleaser).to.throw() + }) + + it('should throw an error if no user callback is passed', function () { + expect(function () { + conventionalGitlabReleaser({}, {}, {}, {}, {}) + }).to.throw() + }) + + it('should not throw if userCb is a callback function', function () { + const userCb = function () {} + expect(function () { + conventionalGitlabReleaser({}, {}, {}, {}, {}, userCb) + }).not.to.throw() + }) +})