Skip to content

Commit de86f6c

Browse files
authored
chore: improve test coverage (#295)
1 parent 2a091dd commit de86f6c

21 files changed

Lines changed: 332 additions & 46 deletions

app/commands/changelog_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package commands
2+
3+
import (
4+
"testing"
5+
6+
"github.com/stretchr/testify/assert"
7+
"github.com/thegeeklab/git-sv/app"
8+
)
9+
10+
func TestChangelogFlags(t *testing.T) {
11+
flags := ChangelogFlags(&app.ChangelogSettings{})
12+
assert.NotEmpty(t, flags)
13+
}
14+
15+
func TestChangelogHandler(t *testing.T) {
16+
gsv := app.New()
17+
settings := &app.ChangelogSettings{}
18+
handler := ChangelogHandler(gsv, settings)
19+
assert.NotNil(t, handler)
20+
}

app/commands/commit_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package commands
2+
3+
import (
4+
"testing"
5+
6+
"github.com/stretchr/testify/assert"
7+
"github.com/thegeeklab/git-sv/app"
8+
)
9+
10+
func TestCommitFlags(t *testing.T) {
11+
flags := CommitFlags()
12+
assert.NotEmpty(t, flags)
13+
}
14+
15+
func TestCommitHandler(t *testing.T) {
16+
gsv := app.New()
17+
handler := CommitHandler(gsv)
18+
assert.NotNil(t, handler)
19+
}

app/commands/commitlog_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package commands
2+
3+
import (
4+
"testing"
5+
6+
"github.com/stretchr/testify/assert"
7+
"github.com/thegeeklab/git-sv/app"
8+
)
9+
10+
func TestCommitLogFlags(t *testing.T) {
11+
flags := CommitLogFlags(&app.CommitLogSettings{})
12+
assert.NotEmpty(t, flags)
13+
}
14+
15+
func TestCommitLogHandler(t *testing.T) {
16+
gsv := app.New()
17+
settings := &app.CommitLogSettings{}
18+
handler := CommitLogHandler(gsv, settings)
19+
assert.NotNil(t, handler)
20+
}

app/commands/commitnotes_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package commands
2+
3+
import (
4+
"testing"
5+
6+
"github.com/stretchr/testify/assert"
7+
"github.com/thegeeklab/git-sv/app"
8+
)
9+
10+
func TestCommitNotesFlags(t *testing.T) {
11+
flags := CommitNotesFlags(&app.CommitNotesSettings{})
12+
assert.NotEmpty(t, flags)
13+
}
14+
15+
func TestCommitNotesHandler(t *testing.T) {
16+
gsv := app.New()
17+
settings := &app.CommitNotesSettings{}
18+
handler := CommitNotesHandler(gsv, settings)
19+
assert.NotNil(t, handler)
20+
}

app/commands/config_test.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package commands
2+
3+
import (
4+
"context"
5+
"testing"
6+
7+
"github.com/stretchr/testify/assert"
8+
"github.com/thegeeklab/git-sv/app"
9+
"github.com/urfave/cli/v3"
10+
)
11+
12+
func TestConfigDefaultHandler(t *testing.T) {
13+
handler := ConfigDefaultHandler()
14+
err := handler(context.Background(), &cli.Command{})
15+
assert.NoError(t, err)
16+
}
17+
18+
func TestConfigShowHandler(t *testing.T) {
19+
cfg := app.GetDefault()
20+
handler := ConfigShowHandler(cfg)
21+
err := handler(context.Background(), &cli.Command{})
22+
assert.NoError(t, err)
23+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package commands
2+
3+
import (
4+
"testing"
5+
6+
"github.com/stretchr/testify/assert"
7+
"github.com/thegeeklab/git-sv/app"
8+
)
9+
10+
func TestCurrentVersionHandler(t *testing.T) {
11+
gsv := app.New()
12+
handler := CurrentVersionHandler(gsv)
13+
assert.NotNil(t, handler)
14+
}

app/commands/nextversion_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package commands
2+
3+
import (
4+
"testing"
5+
6+
"github.com/stretchr/testify/assert"
7+
"github.com/thegeeklab/git-sv/app"
8+
)
9+
10+
func TestNextVersionHandler(t *testing.T) {
11+
gsv := app.New()
12+
handler := NextVersionHandler(gsv)
13+
assert.NotNil(t, handler)
14+
}

app/commands/prompt_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package commands
2+
3+
import (
4+
"testing"
5+
6+
"github.com/stretchr/testify/assert"
7+
)
8+
9+
func TestPromptSelect_InvalidInput(t *testing.T) {
10+
_, err := promptSelect("label", nil, nil)
11+
assert.Error(t, err)
12+
13+
_, err = promptSelect("label", "not-a-slice", nil)
14+
assert.Error(t, err)
15+
}

app/commands/releasenotes_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package commands
2+
3+
import (
4+
"testing"
5+
6+
"github.com/stretchr/testify/assert"
7+
"github.com/thegeeklab/git-sv/app"
8+
)
9+
10+
func TestReleaseNotesFlags(t *testing.T) {
11+
flags := ReleaseNotesFlags(&app.ReleaseNotesSettings{})
12+
assert.NotEmpty(t, flags)
13+
}
14+
15+
func TestReleaseNotesHandler(t *testing.T) {
16+
gsv := app.New()
17+
settings := &app.ReleaseNotesSettings{}
18+
handler := ReleaseNotesHandler(gsv, settings)
19+
assert.NotNil(t, handler)
20+
}

app/commands/tag_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package commands
2+
3+
import (
4+
"testing"
5+
6+
"github.com/stretchr/testify/assert"
7+
"github.com/thegeeklab/git-sv/app"
8+
)
9+
10+
func TestTagFlags(t *testing.T) {
11+
flags := TagFlags(&app.TagSettings{})
12+
assert.NotEmpty(t, flags)
13+
}
14+
15+
func TestTagHandler(t *testing.T) {
16+
gsv := app.New()
17+
settings := &app.TagSettings{}
18+
handler := TagHandler(gsv, settings)
19+
assert.NotNil(t, handler)
20+
}

0 commit comments

Comments
 (0)