Add tests
This commit is contained in:
parent
9f2b142992
commit
41f3020420
1 changed files with 34 additions and 0 deletions
|
|
@ -280,6 +280,40 @@ func TestRunContext_GetBindsAndMounts(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestRunContext_GetGithubContextURL(t *testing.T) {
|
||||
table := []struct {
|
||||
instance string
|
||||
serverUrl string
|
||||
APIUrl string
|
||||
}{
|
||||
{instance: "", serverUrl: "", APIUrl: "/api/v1"},
|
||||
{instance: "example.com", serverUrl: "https://example.com", APIUrl: "https://example.com/api/v1"},
|
||||
{instance: "http://example.com", serverUrl: "http://example.com", APIUrl: "http://example.com/api/v1"},
|
||||
{instance: "https://example.com", serverUrl: "https://example.com", APIUrl: "https://example.com/api/v1"},
|
||||
}
|
||||
for _, data := range table {
|
||||
t.Run(data.instance, func(t *testing.T) {
|
||||
rc := &RunContext{
|
||||
EventJSON: "{}",
|
||||
Config: &Config{
|
||||
GitHubInstance: data.instance,
|
||||
},
|
||||
Run: &model.Run{
|
||||
Workflow: &model.Workflow{
|
||||
Name: "GitHubContextTest",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
ghc := rc.getGithubContext(t.Context())
|
||||
|
||||
assert.Equal(t, data.serverUrl, ghc.ServerURL)
|
||||
assert.Equal(t, data.APIUrl, ghc.APIURL)
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func TestRunContext_GetGithubContextRef(t *testing.T) {
|
||||
table := []struct {
|
||||
event string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue