feat: Add support for Bitbucket

This commit is contained in:
tsuyoshiwada 2018-04-14 15:09:06 +09:00
parent 765f0c96ed
commit 21ae9e8388
8 changed files with 236 additions and 9 deletions

View file

@ -129,3 +129,65 @@ gh-56 hoge fuga`,
),
)
}
func TestBitbucketProcessor(t *testing.T) {
assert := assert.New(t)
config := &Config{
Info: &Info{
RepositoryURL: "https://example.com",
},
}
processor := &BitbucketProcessor{}
processor.Bootstrap(config)
assert.Equal(
&Commit{
Header: "message [@foo](https://bitbucket.org/foo/) [#123](https://example.com/issues/123/)",
Subject: "message [@foo](https://bitbucket.org/foo/) [#123](https://example.com/issues/123/)",
Body: `issue [#456](https://example.com/issues/456/)
multiline [#789](https://example.com/issues/789/)
[@foo](https://bitbucket.org/foo/), [@bar](https://bitbucket.org/bar/)`,
Notes: []*Note{
&Note{
Body: `issue1 [#11](https://example.com/issues/11/)
issue2 [#22](https://example.com/issues/22/)
gh-56 hoge fuga`,
},
},
},
processor.ProcessCommit(
&Commit{
Header: "message @foo #123",
Subject: "message @foo #123",
Body: `issue #456
multiline #789
@foo, @bar`,
Notes: []*Note{
&Note{
Body: `issue1 #11
issue2 #22
gh-56 hoge fuga`,
},
},
},
),
)
assert.Equal(
&Commit{
Revert: &Revert{
Header: "revert header [@mention](https://bitbucket.org/mention/) [#123](https://example.com/issues/123/)",
},
},
processor.ProcessCommit(
&Commit{
Revert: &Revert{
Header: "revert header @mention #123",
},
},
),
)
}