diff options
Diffstat (limited to 'pkg/commands/pull_request_test.go')
-rw-r--r-- | pkg/commands/pull_request_test.go | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/pkg/commands/pull_request_test.go b/pkg/commands/pull_request_test.go deleted file mode 100644 index 844a15998..000000000 --- a/pkg/commands/pull_request_test.go +++ /dev/null @@ -1,64 +0,0 @@ -package commands - -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - -// TestGetRepoInfoFromURL is a function. -func TestGetRepoInfoFromURL(t *testing.T) { - type scenario struct { - serviceDefinition ServiceDefinition - testName string - repoURL string - test func(*RepoInformation) - } - - scenarios := []scenario{ - { - GithubServiceDef, - "Returns repository information for git remote url", - "git@github.com:petersmith/super_calculator", - func(repoInfo *RepoInformation) { - assert.EqualValues(t, repoInfo.Owner, "petersmith") - assert.EqualValues(t, repoInfo.Repository, "super_calculator") - }, - }, - { - GithubServiceDef, - "Returns repository information for git remote url, trimming trailing '.git'", - "git@github.com:petersmith/super_calculator.git", - func(repoInfo *RepoInformation) { - assert.EqualValues(t, repoInfo.Owner, "petersmith") - assert.EqualValues(t, repoInfo.Repository, "super_calculator") - }, - }, - { - GithubServiceDef, - "Returns repository information for ssh remote url", - "ssh://git@github.com/petersmith/super_calculator", - func(repoInfo *RepoInformation) { - assert.EqualValues(t, repoInfo.Owner, "petersmith") - assert.EqualValues(t, repoInfo.Repository, "super_calculator") - }, - }, - { - GithubServiceDef, - "Returns repository information for http remote url", - "https://my_username@bitbucket.org/johndoe/social_network.git", - func(repoInfo *RepoInformation) { - assert.EqualValues(t, repoInfo.Owner, "johndoe") - assert.EqualValues(t, repoInfo.Repository, "social_network") - }, - }, - } - - for _, s := range scenarios { - t.Run(s.testName, func(t *testing.T) { - result, err := s.serviceDefinition.getRepoInfoFromURL(s.repoURL) - assert.NoError(t, err) - s.test(result) - }) - } -} |