Skip to content

Commit dcc4e9a

Browse files
committed
test: Add test for makeFullUrl
1 parent a007ecb commit dcc4e9a

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

go.mod

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,27 @@ require (
66
github.com/alecthomas/kong v0.5.0
77
github.com/go-git/go-billy/v5 v5.3.1
88
github.com/go-git/go-git/v5 v5.4.2
9+
github.com/stretchr/testify v1.7.0
910
)
1011

1112
require (
1213
github.com/Microsoft/go-winio v0.4.16 // indirect
1314
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 // indirect
1415
github.com/acomagu/bufpipe v1.0.3 // indirect
16+
github.com/davecgh/go-spew v1.1.1 // indirect
1517
github.com/emirpasic/gods v1.12.0 // indirect
1618
github.com/go-git/gcfg v1.5.0 // indirect
1719
github.com/imdario/mergo v0.3.12 // indirect
1820
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
1921
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect
2022
github.com/mitchellh/go-homedir v1.1.0 // indirect
2123
github.com/pkg/errors v0.9.1 // indirect
24+
github.com/pmezard/go-difflib v1.0.0 // indirect
2225
github.com/sergi/go-diff v1.1.0 // indirect
2326
github.com/xanzy/ssh-agent v0.3.0 // indirect
2427
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect
2528
golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect
2629
golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9 // indirect
2730
gopkg.in/warnings.v0 v0.1.2 // indirect
31+
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
2832
)

go.sum

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ golang.org/x/crypto v0.0.0-20220214200702-86341886e292 h1:f+lwQ+GtmgoY+A2YaQxlSO
7676
golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
7777
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
7878
golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k=
79-
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
8079
golang.org/x/net v0.0.0-20220225172249-27dd8689420f h1:oA4XRj0qtSt8Yo1Zms0CUlsT3KG69V2UGQWPBxujDmc=
8180
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
8281
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -86,19 +85,13 @@ golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7w
8685
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
8786
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
8887
golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
89-
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
9088
golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
91-
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
92-
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
9389
golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9 h1:nhht2DYV/Sn3qOayu8lM+cU1ii9sTLUeBQwQQfUHtrs=
9490
golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
9591
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
9692
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
97-
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
9893
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
99-
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
10094
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
101-
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
10295
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
10396
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
10497
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

monorepo_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package monorepo
2+
3+
import (
4+
"testing"
5+
6+
"github.com/stretchr/testify/assert"
7+
)
8+
9+
func TestMakeUrlFromSpec(t *testing.T) {
10+
11+
assert := assert.New(t)
12+
13+
assert.Equal("https://github.com/zikani03/git-monorepo", makeFullUrl("gh:zikani03/git-monorepo"))
14+
assert.Equal("https://bitbucket.org/zikani03/git-monorepo", makeFullUrl("bb:zikani03/git-monorepo"))
15+
assert.Equal("https://gitlab.com/zikani03/git-monorepo", makeFullUrl("gl:zikani03/git-monorepo"))
16+
17+
assert.Equal("somethingelse:zikani03/git-monorepo", makeFullUrl("somethingelse:zikani03/git-monorepo"))
18+
}

0 commit comments

Comments
 (0)