Skip to content

Commit

Permalink
Expand getRepoDetailsFromRemote tests
Browse files Browse the repository at this point in the history
  • Loading branch information
simenbrekken-visma authored and ejoffe committed Mar 15, 2024
1 parent ee694f5 commit 00e9b06
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions config/config_parser/config_parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,30 @@ func TestGetRepoDetailsFromRemote(t *testing.T) {
{"origin https://github.com/r2/d2.git (push)", "github.com", "r2", "d2", true},
{"origin https://github.com/r2/d2.git (fetch)", "", "", "", false},
{"origin https://github.com/r2/d2 (push)", "github.com", "r2", "d2", true},
{"origin https://github.com/r-2/d-2 (push)", "github.com", "r-2", "d-2", true},

{"origin ssh://git@github.com/r2/d2.git (push)", "github.com", "r2", "d2", true},
{"origin ssh://git@github.com/r2/d2.git (fetch)", "", "", "", false},
{"origin ssh://git@github.com/r2/d2 (push)", "github.com", "r2", "d2", true},
{"origin ssh://git@github.com/r-2/d-2 (push)", "github.com", "r-2", "d-2", true},

{"origin git@github.com:r2/d2.git (push)", "github.com", "r2", "d2", true},
{"origin git@github.com:r2/d2.git (fetch)", "", "", "", false},
{"origin git@github.com:r2/d2 (push)", "github.com", "r2", "d2", true},
{"origin git@github.com:r-2/d-2 (push)", "github.com", "r-2", "d-2", true},

{"origin git@gh.enterprise.com:r2/d2.git (push)", "gh.enterprise.com", "r2", "d2", true},
{"origin git@gh.enterprise.com:r2/d2.git (fetch)", "", "", "", false},
{"origin git@gh.enterprise.com:r2/d2 (push)", "gh.enterprise.com", "r2", "d2", true},
{"origin git@gh.enterprise.com:r-2/d-2 (push)", "gh.enterprise.com", "r-2", "d-2", true},

{"origin https://github.com/r2/d2-a.git (push)", "github.com", "r2", "d2-a", true},
{"origin https://github.com/r-2/d2-a.git (push)", "github.com", "r-2", "d2-a", true},
{"origin https://github.com/r2/d2_a.git (push)", "github.com", "r2", "d2_a", true},
{"origin https://github.com/r-2/d2_a.git (push)", "github.com", "r-2", "d2_a", true},

// GitHub names are case-sensitive
{"origin https://github.com/R2/D2.git (push)", "github.com", "R2", "D2", true},
}
for i, testCase := range testCases {
t.Logf("Testing %v %q", i, testCase.remote)
Expand Down

0 comments on commit 00e9b06

Please sign in to comment.