Skip to content

Commit

Permalink
fix: lint errors (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
arnested authored Jan 21, 2024
1 parent c28f513 commit 819eaf2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
18 changes: 11 additions & 7 deletions format_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,23 @@ func TestFormatChangelog(t *testing.T) {

func accept(t *testing.T, tmplData string, pkg PackageChangeLog) {
t.Helper()
if tpl, err := LoadTemplateData(tmplData); err != nil {

tpl, err := LoadTemplateData(tmplData)
if err != nil {
t.Error(err)

return
} else if testdata, err := FormatChangelog(&pkg, tpl); err != nil {
}

testdata, err := FormatChangelog(&pkg, tpl)
if err != nil {
t.Error(err)

return
} else {
golddata, _ := os.ReadFile(fmt.Sprintf("./testdata/%s", pkg.Name))
}

if diff := cmp.Diff(string(golddata), testdata); diff != "" {
t.Errorf("FormatChangelog mismatch (+got -want):\n%s", diff)
}
golddata, _ := os.ReadFile(fmt.Sprintf("./testdata/%s", pkg.Name))
if diff := cmp.Diff(string(golddata), testdata); diff != "" {
t.Errorf("FormatChangelog mismatch (+got -want):\n%s", diff)
}
}
22 changes: 11 additions & 11 deletions order_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/object"
"github.com/go-git/go-git/v5/storage/memory"
. "github.com/smartystreets/goconvey/convey"
"github.com/smartystreets/goconvey/convey"
)

type testRepo struct {
Expand Down Expand Up @@ -118,8 +118,8 @@ func TestOrderChangelog(t *testing.T) {
t.Fatal(err)
}

Convey("Generated entry should be the same as the golden entry", t, func() {
So(testCLE, ShouldResemble, goldCLE)
convey.Convey("Generated entry should be the same as the golden entry", t, func() {
convey.So(testCLE, convey.ShouldResemble, goldCLE)
})
}

Expand Down Expand Up @@ -209,16 +209,16 @@ func TestOffBranchTags(t *testing.T) {
}
}

Convey("Generated entry should be the same as the golden entry", t, func() {
So(testCLE, ShouldResemble, goldCLE)
convey.Convey("Generated entry should be the same as the golden entry", t, func() {
convey.So(testCLE, convey.ShouldResemble, goldCLE)
})
}

func TestSemverTag(t *testing.T) {
repo := newTestRepo()
tag := "1.0.0"

Convey("Semver tags should be parsed", t, func() {
convey.Convey("Semver tags should be parsed", t, func() {
hash := repo.modifyAndCommit(defCommitOptions())

if _, err := repo.Git.CreateTag(tag, hash, nil); err != nil {
Expand All @@ -230,11 +230,11 @@ func TestSemverTag(t *testing.T) {
t.Fatal(err)
}

So(cle, ShouldHaveLength, 1)
So(cle[0].Semver, ShouldEqual, tag)
convey.So(cle, convey.ShouldHaveLength, 1)
convey.So(cle[0].Semver, convey.ShouldEqual, tag)
})

Convey("Not Semver tags should be ignored", t, func() {
convey.Convey("Not Semver tags should be ignored", t, func() {
hash := repo.modifyAndCommit(defCommitOptions())

if _, err := repo.Git.CreateTag("text", hash, nil); err != nil {
Expand All @@ -246,7 +246,7 @@ func TestSemverTag(t *testing.T) {
t.Fatal(err)
}

So(cle, ShouldHaveLength, 1)
So(cle[0].Semver, ShouldEqual, tag)
convey.So(cle, convey.ShouldHaveLength, 1)
convey.So(cle[0].Semver, convey.ShouldEqual, tag)
})
}

0 comments on commit 819eaf2

Please sign in to comment.