Skip to content

Commit

Permalink
Add: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lexich committed Oct 27, 2016
1 parent 362985a commit d7ffaa5
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ function writePackageJson (version, option) {
fs.writeFileSync('package.json', JSON.stringify(pkg), 'utf-8')
}

function writeBowerJson (version, option) {
option = option || {}
var bower = objectAssign(option, { version: version })
fs.writeFileSync('bower.json', JSON.stringify(bower), 'utf-8')
}

function writeGitPreCommitHook () {
fs.writeFileSync('.git/hooks/pre-commit', '#!/bin/sh\necho "precommit ran"\nexit 1', 'utf-8')
fs.chmodSync('.git/hooks/pre-commit', '755')
Expand Down Expand Up @@ -301,6 +307,24 @@ describe('standard-version', function () {
})
})

describe('with bower.json', function () {
beforeEach(function () {
writeBowerJson('1.0.0')
})

it('check with bower.json', function (done) {
commit('feat: first commit')
shell.exec('git tag -a v1.0.0 -m "my awesome first release"')
commit('feat: new feature!')
require('./index')({silent: true}, function (err) {
should.not.exist(err)
var bower = fs.readFileSync('bower.json', 'utf-8')
bower.should.match(/"version": "1\.2\.0"/)
done()
})
})
})

it('formats the commit and tag messages appropriately', function (done) {
commit('feat: first commit')
shell.exec('git tag -a v1.0.0 -m "my awesome first release"')
Expand Down

0 comments on commit d7ffaa5

Please sign in to comment.