github.com/jingweno/gh@v2.1.1-0.20221007190738-04a7985fa9a1+incompatible/commands/pull_request_test.go (about)

     1  package commands
     2  
     3  import (
     4  	"github.com/bmizerany/assert"
     5  	"github.com/jingweno/gh/github"
     6  	"testing"
     7  )
     8  
     9  func TestParsePullRequestProject(t *testing.T) {
    10  	c := &github.Project{Host: "github.com", Owner: "jingweno", Name: "gh"}
    11  
    12  	s := "develop"
    13  	p, ref := parsePullRequestProject(c, s)
    14  	assert.Equal(t, "develop", ref)
    15  	assert.Equal(t, "github.com", p.Host)
    16  	assert.Equal(t, "jingweno", p.Owner)
    17  	assert.Equal(t, "gh", p.Name)
    18  
    19  	s = "mojombo:develop"
    20  	p, ref = parsePullRequestProject(c, s)
    21  	assert.Equal(t, "develop", ref)
    22  	assert.Equal(t, "github.com", p.Host)
    23  	assert.Equal(t, "mojombo", p.Owner)
    24  	assert.Equal(t, "gh", p.Name)
    25  
    26  	s = "mojombo/jekyll:develop"
    27  	p, ref = parsePullRequestProject(c, s)
    28  	assert.Equal(t, "develop", ref)
    29  	assert.Equal(t, "github.com", p.Host)
    30  	assert.Equal(t, "mojombo", p.Owner)
    31  	assert.Equal(t, "jekyll", p.Name)
    32  }