Files
build-emacs-for-macos/pkg/repository/repository_test.go
Jim Myhrberg 743b10c751 feat(plan): add support for pretest and release candidate builds
Add support for naming release and builds accordingly when given a git
ref for a pretest (90 or above patch number) or release
candidate ("-rcX" at the end of the tag).
2021-12-05 12:52:08 +00:00

55 lines
1.0 KiB
Go

package repository
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestRepository_ReleaseURL(t *testing.T) {
type fields struct {
Type Type
Source string
}
type args struct {
releaseName string
}
tests := []struct {
name string
fields fields
args args
want string
}{
{
name: "empty name",
fields: fields{Type: GitHub, Source: "foo/bar"},
args: args{releaseName: ""},
want: "",
},
{
name: "GitHub, foo/bar, v1.0.0",
fields: fields{Type: GitHub, Source: "foo/bar"},
args: args{releaseName: "v1.0.0"},
want: "https://github.com/foo/bar/releases/tag/v1.0.0",
},
{
name: "Not GitHub, foo/bar, v1.0.0",
fields: fields{Type: Type("oops"), Source: "foo/bar"},
args: args{releaseName: "v1.0.0"},
want: "",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
repo := &Repository{
Type: tt.fields.Type,
Source: tt.fields.Source,
}
got := repo.ReleaseURL(tt.args.releaseName)
assert.Equal(t, tt.want, got)
})
}
}