Test FindByName
This commit is contained in:
parent
51c70dd918
commit
d334d56f09
1 changed files with 19 additions and 0 deletions
|
|
@ -57,3 +57,22 @@ func Test_parseRemotes(t *testing.T) {
|
|||
eq(t, r[1], &Remote{Name: "origin", Owner: "monalisa", Repo: "octo-cat"})
|
||||
eq(t, r[2], &Remote{Name: "upstream", Owner: "hubot", Repo: "tools"})
|
||||
}
|
||||
|
||||
func Test_Remotes_FindByName(t *testing.T) {
|
||||
list := Remotes{
|
||||
&Remote{Name: "mona", Owner: "monalisa", Repo: "myfork"},
|
||||
&Remote{Name: "origin", Owner: "monalisa", Repo: "octo-cat"},
|
||||
&Remote{Name: "upstream", Owner: "hubot", Repo: "tools"},
|
||||
}
|
||||
|
||||
r, err := list.FindByName("upstream", "origin")
|
||||
eq(t, err, nil)
|
||||
eq(t, r.Name, "upstream")
|
||||
|
||||
r, err = list.FindByName("nonexist", "*")
|
||||
eq(t, err, nil)
|
||||
eq(t, r.Name, "mona")
|
||||
|
||||
_, err = list.FindByName("nonexist")
|
||||
eq(t, err, errors.New(`no GitHub remotes found`))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue