Skip to content

Commit

Permalink
Merge pull request #142 from Ramesh7/bug-fixing-repo_name-repo_owner-…
Browse files Browse the repository at this point in the history
…toggle

bugfix: Release creation toggling RepoName & RepoOwner
  • Loading branch information
chelnak authored Oct 9, 2023
2 parents 31bc3a1 + e695888 commit c928ca7
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion internal/get/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func changelogWithSingleEntry(entry entry.Entry, repoName, repoOwner string) cha
entry.Next = nil
entry.Previous = nil

cl := changelog.NewChangelog(repoName, repoOwner)
cl := changelog.NewChangelog(repoOwner, repoName)
cl.Insert(entry)
return cl
}
Expand Down
2 changes: 1 addition & 1 deletion internal/writer/writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const (
)

func Test_ItWritesOutAChangelogInTheCorrectFormat(t *testing.T) {
mockChangelog := changelog.NewChangelog(repoName, repoOwner)
mockChangelog := changelog.NewChangelog(repoOwner, repoName)

entry := entry.Entry{
Tag: "v1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion pkg/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ func NewBuilder(options BuilderOptions) (Builder, error) {
}

changelog := changelog.NewChangelog(
options.GitHubClient.GetRepoName(),
options.GitHubClient.GetRepoOwner(),
options.GitHubClient.GetRepoName(),
)

builder := &builder{
Expand Down
2 changes: 1 addition & 1 deletion pkg/changelog/changelog.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (c *changelog) Tail() *entry.Entry {
}

// NewChangelog creates a new changelog datastructure.
func NewChangelog(repoName string, repoOwner string) Changelog {
func NewChangelog(repoOwner string, repoName string) Changelog {
return &changelog{
repoName: repoName,
repoOwner: repoOwner,
Expand Down
12 changes: 6 additions & 6 deletions pkg/changelog/changelog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ var entries = []entry.Entry{
}

func TetstNewChangelog(t *testing.T) {
var testChangelog = changelog.NewChangelog(repoName, repoOwner)
var testChangelog = changelog.NewChangelog(repoOwner, repoName)
assert.Equal(t, repoName, testChangelog.GetRepoName())
assert.Equal(t, repoOwner, testChangelog.GetRepoOwner())
assert.Equal(t, 0, len(testChangelog.GetEntries()))
assert.Equal(t, 0, len(testChangelog.GetUnreleased()))
}

func TestInsert(t *testing.T) {
var testChangelog = changelog.NewChangelog(repoName, repoOwner)
var testChangelog = changelog.NewChangelog(repoOwner, repoName)
for _, e := range entries {
err := e.Append("added", "test")
assert.Nil(t, err)
Expand All @@ -49,7 +49,7 @@ func TestInsert(t *testing.T) {
}

func TestTail(t *testing.T) {
var testChangelog = changelog.NewChangelog(repoName, repoOwner)
var testChangelog = changelog.NewChangelog(repoOwner, repoName)

for _, e := range entries {
err := e.Append("added", "test")
Expand All @@ -63,7 +63,7 @@ func TestTail(t *testing.T) {
}

func TestHead(t *testing.T) {
var testChangelog = changelog.NewChangelog(repoName, repoOwner)
var testChangelog = changelog.NewChangelog(repoOwner, repoName)
entries := []entry.Entry{
{
Tag: "v2.0.0",
Expand All @@ -87,7 +87,7 @@ func TestHead(t *testing.T) {
}

func TestAddUnreleased(t *testing.T) {
var testChangelog = changelog.NewChangelog(repoName, repoOwner)
var testChangelog = changelog.NewChangelog(repoOwner, repoName)
testChangelog.AddUnreleased([]string{"test"})

unreleased := testChangelog.GetUnreleased()
Expand All @@ -97,7 +97,7 @@ func TestAddUnreleased(t *testing.T) {
}

func TestGetEntries(t *testing.T) {
var testChangelog = changelog.NewChangelog(repoName, repoOwner)
var testChangelog = changelog.NewChangelog(repoOwner, repoName)
for _, e := range entries {
err := e.Append("added", "test")
assert.Nil(t, err)
Expand Down
4 changes: 2 additions & 2 deletions pkg/entry/entry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestNewEntry(t *testing.T) {
}

func TestPrevious(t *testing.T) {
var testChangelog = changelog.NewChangelog(repoName, repoOwner)
var testChangelog = changelog.NewChangelog(repoOwner, repoName)
entries := []entry.Entry{
{
Tag: "v2.0.0",
Expand All @@ -48,7 +48,7 @@ func TestPrevious(t *testing.T) {
}

func TestNext(t *testing.T) {
var testChangelog = changelog.NewChangelog(repoName, repoOwner)
var testChangelog = changelog.NewChangelog(repoOwner, repoName)
entries := []entry.Entry{
{
Tag: "v2.0.0",
Expand Down

0 comments on commit c928ca7

Please sign in to comment.