Skip to content
This repository was archived by the owner on Feb 5, 2018. It is now read-only.

Commit bb20a7b

Browse files
committed
fix(template): wrong version link if no host
Fixes #8
1 parent cd1a75a commit bb20a7b

File tree

3 files changed

+36
-2
lines changed

3 files changed

+36
-2
lines changed

templates/header.hbs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
{{~else~}}
55
#
66
{{~/if}} {{#if @root.linkCompare~}}
7-
[{{version}}]({{@root.host}}/
7+
[{{version}}](
8+
{{~#if @root.host}}
9+
{{~@root.host}}/
10+
{{~/if}}
811
{{~#if @root.owner}}
912
{{~@root.owner}}/
1013
{{~/if}}

test/fixtures/_unknown-host.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"repository": "unknown",
3+
"version": "v2.0.0"
4+
}

test.js renamed to test/test.js

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22
var child = require('child_process');
33
var conventionalChangelogCore = require('conventional-changelog-core');
4-
var preset = require('./');
4+
var preset = require('../');
55
var expect = require('chai').expect;
66
var gitDummyCommit = require('git-dummy-commit');
77
var shell = require('shelljs');
@@ -147,4 +147,31 @@ describe('angular preset', function() {
147147
done();
148148
}));
149149
});
150+
151+
it('should work with unknown host', function(done) {
152+
var i = 0;
153+
154+
conventionalChangelogCore({
155+
config: preset,
156+
pkg: {
157+
path: __dirname + '/fixtures/_unknown-host.json'
158+
},
159+
})
160+
.on('error', function(err) {
161+
done(err);
162+
})
163+
.pipe(through(function(chunk, enc, cb) {
164+
chunk = chunk.toString();
165+
166+
expect(chunk).to.include('(http://unknown/compare');
167+
expect(chunk).to.include('](http://unknown/commits/');
168+
169+
i++;
170+
cb();
171+
}, function() {
172+
expect(i).to.equal(1);
173+
done();
174+
}));
175+
});
176+
150177
});

0 commit comments

Comments
 (0)