From b37bc660da13a4a807cd4bb34a3e609d8c0971cd Mon Sep 17 00:00:00 2001 From: Tom Chen Date: Sat, 25 Nov 2017 15:35:58 +0800 Subject: [PATCH] test(format-commit-message): add failing test cases --- test.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test.js b/test.js index a99a55522..b18cf7150 100644 --- a/test.js +++ b/test.js @@ -9,6 +9,7 @@ var stream = require('stream') var mockGit = require('mock-git') var mockery = require('mockery') var semver = require('semver') +var formatCommitMessage = require('./lib/format-commit-message') var cli = require('./command') var standardVersion = require('./index') @@ -101,6 +102,18 @@ function getPackageVersion () { return JSON.parse(fs.readFileSync('package.json', 'utf-8')).version } +describe('format-commit-message', function () { + it('works for no %s', function () { + formatCommitMessage('chore(release): 1.0.0', '1.0.0').should.equal('chore(release): 1.0.0') + }) + it('works for one %s', function () { + formatCommitMessage('chore(release): %s', '1.0.0').should.equal('chore(release): 1.0.0') + }) + it('works for two %s', function () { + formatCommitMessage('chore(release): %s \n\n* CHANGELOG: https://github.com/conventional-changelog/standard-version/blob/v%s/CHANGELOG.md', '1.0.0').should.equal('chore(release): 1.0.0 \n\n* CHANGELOG: https://github.com/conventional-changelog/standard-version/blob/v1.0.0/CHANGELOG.md') + }) +}) + describe('cli', function () { beforeEach(initInTempFolder) afterEach(finishTemp)