forked from getantibody/getantibody
/
release_test.go
51 lines (44 loc) · 1004 Bytes
/
release_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package getantibody_test
import (
"testing"
"github.com/caarlos0/getantibody"
"github.com/stretchr/testify/assert"
)
func TestLatest(t *testing.T) {
release, err := getantibody.LatestRelease()
assert.NotEmpty(t, release)
assert.NoError(t, err)
}
func TestDownloadURLValidOSAndArch(t *testing.T) {
release, _ := getantibody.LatestRelease()
url, err := getantibody.DownloadURL(
release,
"Darwin",
"x86_64",
)
assert.Contains(t, url, "github.com")
assert.NoError(t, err)
}
func TestDownloadURLInvalidOS(t *testing.T) {
release, _ := getantibody.LatestRelease()
url, err := getantibody.DownloadURL(
release,
"windows",
"x86_64",
)
assert.Empty(t, url)
assert.Error(t, err)
}
func TestDownloadURLInvalidArch(t *testing.T) {
release, _ := getantibody.LatestRelease()
url, err := getantibody.DownloadURL(
release,
"darwin",
"ppc",
)
assert.Empty(t, url)
assert.Error(t, err)
}
func TestDistributions(t *testing.T) {
assert.Len(t, getantibody.Distributions(), 5)
}